summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qinputcontextfactory.h
blob: 16c17e41a8046b92c8472529038c978d5e710a20 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

/****************************************************************************
**
** Definition of QInputContextFactory class
**
** Copyright (C) 2003-2004 immodule for Qt Project.  All rights reserved.
**
** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/

#ifndef QINPUTCONTEXTFACTORY_H
#define QINPUTCONTEXTFACTORY_H

#include <QtCore/qstringlist.h>

QT_BEGIN_HEADER

QT_BEGIN_NAMESPACE

QT_MODULE(Gui)

#ifndef QT_NO_IM

class QInputContext;
class QWidget;

class Q_GUI_EXPORT QInputContextFactory
{
public:
    static QStringList keys();
    static QInputContext *create( const QString &key, QObject *parent ); // should be a toplevel widget
    static QStringList languages( const QString &key );
    static QString displayName( const QString &key );
    static QString description( const QString &key );
};

#endif // QT_NO_IM

QT_END_NAMESPACE

QT_END_HEADER

#endif // QINPUTCONTEXTFACTORY_H
| 430 +- hl/test/h5hltest.h | 19 +- hl/test/pal_rgb.h | 7 - hl/test/test_ds.c | 3979 +-- hl/test/test_dset_append.c | 869 +- hl/test/test_file_image.c | 180 +- hl/test/test_h5do_compat.c | 90 +- hl/test/test_image.c | 746 +- hl/test/test_ld.c | 1268 +- hl/test/test_lite.c | 2044 +- hl/test/test_packet.c | 776 +- hl/test/test_packet_vlen.c | 1068 +- hl/test/test_table.c | 1815 +- hl/tools/gif2h5/decompress.c | 176 +- hl/tools/gif2h5/gif.h | 81 +- hl/tools/gif2h5/gif2hdf.c | 46 +- hl/tools/gif2h5/gif2mem.c | 181 +- hl/tools/gif2h5/gifread.c | 311 +- hl/tools/gif2h5/h52gifgentst.c | 66 +- hl/tools/gif2h5/hdf2gif.c | 229 +- hl/tools/gif2h5/hdfgifwr.c | 217 +- hl/tools/gif2h5/writehdf.c | 57 +- hl/tools/h5watch/extend_dset.c | 292 +- hl/tools/h5watch/h5watch.c | 556 +- hl/tools/h5watch/h5watchgentest.c | 275 +- hl/tools/h5watch/swmr_check_compat_vfd.c | 8 +- java/src/jni/exceptionImp.c | 135 +- java/src/jni/exceptionImp.h | 25 +- java/src/jni/h5Constants.c | 3268 +- java/src/jni/h5Imp.c | 44 +- java/src/jni/h5Imp.h | 33 +- java/src/jni/h5aImp.c | 594 +- java/src/jni/h5aImp.h | 220 +- java/src/jni/h5dImp.c | 662 +- java/src/jni/h5dImp.h | 182 +- java/src/jni/h5eImp.c | 112 +- java/src/jni/h5eImp.h | 70 +- java/src/jni/h5fImp.c | 165 +- java/src/jni/h5fImp.h | 122 +- java/src/jni/h5gImp.c | 68 +- java/src/jni/h5gImp.h | 44 +- java/src/jni/h5iImp.c | 65 +- java/src/jni/h5iImp.h | 60 +- java/src/jni/h5jni.h | 498 +- java/src/jni/h5lImp.c | 283 +- java/src/jni/h5lImp.h | 90 +- java/src/jni/h5oImp.c | 324 +- java/src/jni/h5oImp.h | 116 +- java/src/jni/h5pDAPLImp.c | 93 +- java/src/jni/h5pDAPLImp.h | 39 +- java/src/jni/h5pDCPLImp.c | 470 +- java/src/jni/h5pDCPLImp.h | 174 +- java/src/jni/h5pDXPLImp.c | 110 +- java/src/jni/h5pDXPLImp.h | 60 +- java/src/jni/h5pFAPLImp.c | 515 +- java/src/jni/h5pFAPLImp.h | 210 +- java/src/jni/h5pFCPLImp.c | 174 +- java/src/jni/h5pFCPLImp.h | 87 +- java/src/jni/h5pGCPLImp.c | 54 +- java/src/jni/h5pGCPLImp.h | 32 +- java/src/jni/h5pImp.c | 371 +- java/src/jni/h5pImp.h | 111 +- java/src/jni/h5pLAPLImp.c | 45 +- java/src/jni/h5pLAPLImp.h | 32 +- java/src/jni/h5pOCPLImp.c | 38 +- java/src/jni/h5pOCPLImp.h | 33 +- java/src/jni/h5pOCpyPLImp.c | 6 +- java/src/jni/h5pOCpyPLImp.h | 8 +- java/src/jni/h5pStrCPLImp.c | 6 +- java/src/jni/h5pStrCPLImp.h | 8 +- java/src/jni/h5plImp.c | 53 +- java/src/jni/h5plImp.h | 36 +- java/src/jni/h5rImp.c | 274 +- java/src/jni/h5rImp.h | 86 +- java/src/jni/h5sImp.c | 458 +- java/src/jni/h5sImp.h | 133 +- java/src/jni/h5tImp.c | 423 +- java/src/jni/h5tImp.h | 277 +- java/src/jni/h5util.c | 1351 +- java/src/jni/h5util.h | 78 +- java/src/jni/h5vlImp.c | 59 +- java/src/jni/h5vlImp.h | 43 +- java/src/jni/h5zImp.c | 12 +- java/src/jni/h5zImp.h | 12 +- java/src/jni/nativeData.c | 486 +- java/src/jni/nativeData.h | 95 +- src/H5.c | 527 +- src/H5A.c | 691 +- src/H5AC.c | 1102 +- src/H5ACdbg.c | 63 +- src/H5ACmodule.h | 7 +- src/H5ACmpio.c | 768 +- src/H5ACpkg.h | 87 +- src/H5ACprivate.h | 311 +- src/H5ACproxy_entry.c | 222 +- src/H5ACpublic.h | 86 +- src/H5Abtree2.c | 182 +- src/H5Adense.c | 1051 +- src/H5Adeprec.c | 158 +- src/H5Aint.c | 1115 +- src/H5Amodule.h | 7 +- src/H5Apkg.h | 202 +- src/H5Aprivate.h | 39 +- src/H5Apublic.h | 93 +- src/H5Atest.c | 51 +- src/H5B.c | 1207 +- src/H5B2.c | 757 +- src/H5B2cache.c | 537 +- src/H5B2dbg.c | 186 +- src/H5B2hdr.c | 284 +- src/H5B2int.c | 1298 +- src/H5B2internal.c | 837 +- src/H5B2leaf.c | 505 +- src/H5B2module.h | 8 +- src/H5B2pkg.h | 451 +- src/H5B2private.h | 122 +- src/H5B2stat.c | 33 +- src/H5B2test.c | 201 +- src/H5Bcache.c | 145 +- src/H5Bdbg.c | 152 +- src/H5Bmodule.h | 7 +- src/H5Bpkg.h | 36 +- src/H5Bprivate.h | 127 +- src/H5C.c | 11260 ++++--- src/H5CS.c | 84 +- src/H5CSprivate.h | 9 +- src/H5CX.c | 1265 +- src/H5CXmodule.h | 7 +- src/H5CXprivate.h | 71 +- src/H5Cdbg.c | 1028 +- src/H5Cepoch.c | 110 +- src/H5Cimage.c | 1811 +- src/H5Clog.c | 276 +- src/H5Clog.h | 99 +- src/H5Clog_json.c | 506 +- src/H5Clog_trace.c | 390 +- src/H5Cmodule.h | 7 +- src/H5Cmpio.c | 767 +- src/H5Cpkg.h | 1 - src/H5Cprefetched.c | 141 +- src/H5Cprivate.h | 618 +- src/H5Cpublic.h | 15 +- src/H5Cquery.c | 148 +- src/H5Ctag.c | 269 +- src/H5Ctest.c | 52 +- src/H5D.c | 405 +- src/H5Dbtree.c | 616 +- src/H5Dbtree2.c | 641 +- src/H5Dchunk.c | 3988 ++- src/H5Dcompact.c | 276 +- src/H5Dcontig.c | 813 +- src/H5Ddbg.c | 37 +- src/H5Ddeprec.c | 139 +- src/H5Dearray.c | 683 +- src/H5Defl.c | 265 +- src/H5Dfarray.c | 611 +- src/H5Dfill.c | 305 +- src/H5Dint.c | 1890 +- src/H5Dio.c | 675 +- src/H5Dlayout.c | 303 +- src/H5Dmodule.h | 7 +- src/H5Dmpio.c | 1856 +- src/H5Dnone.c | 158 +- src/H5Doh.c | 198 +- src/H5Dpkg.h | 791 +- src/H5Dprivate.h | 166 +- src/H5Dpublic.h | 176 +- src/H5Dscatgath.c | 623 +- src/H5Dselect.c | 179 +- src/H5Dsingle.c | 194 +- src/H5Dtest.c | 84 +- src/H5Dvirtual.c | 1848 +- src/H5E.c | 551 +- src/H5EA.c | 1327 +- src/H5EAcache.c | 2681 +- src/H5EAdbg.c | 631 +- src/H5EAdblkpage.c | 311 +- src/H5EAdblock.c | 551 +- src/H5EAhdr.c | 755 +- src/H5EAiblock.c | 562 +- src/H5EAint.c | 59 +- src/H5EAmodule.h | 7 +- src/H5EApkg.h | 467 +- src/H5EAprivate.h | 97 +- src/H5EAsblock.c | 467 +- src/H5EAstat.c | 44 +- src/H5EAtest.c | 377 +- src/H5ESpublic.h | 12 +- src/H5Edeprec.c | 130 +- src/H5Eint.c | 388 +- src/H5Emodule.h | 8 +- src/H5Epkg.h | 80 +- src/H5Eprivate.h | 142 +- src/H5Epublic.h | 195 +- src/H5F.c | 695 +- src/H5FA.c | 931 +- src/H5FAcache.c | 1425 +- src/H5FAdbg.c | 358 +- src/H5FAdblkpage.c | 290 +- src/H5FAdblock.c | 483 +- src/H5FAhdr.c | 503 +- src/H5FAint.c | 59 +- src/H5FAmodule.h | 7 +- src/H5FApkg.h | 268 +- src/H5FAprivate.h | 82 +- src/H5FAstat.c | 44 +- src/H5FAtest.c | 286 +- src/H5FD.c | 548 +- src/H5FDcore.c | 851 +- src/H5FDcore.h | 11 +- src/H5FDdirect.c | 954 +- src/H5FDdirect.h | 20 +- src/H5FDdrvr_module.h | 7 +- src/H5FDfamily.c | 661 +- src/H5FDfamily.h | 11 +- src/H5FDhdfs.c | 554 +- src/H5FDhdfs.h | 11 +- src/H5FDint.c | 146 +- src/H5FDlog.c | 1006 +- src/H5FDlog.h | 53 +- src/H5FDmirror.c | 727 +- src/H5FDmirror.h | 9 +- src/H5FDmirror_priv.h | 36 +- src/H5FDmodule.h | 7 +- src/H5FDmpi.c | 89 +- src/H5FDmpi.h | 9 +- src/H5FDmpio.c | 790 +- src/H5FDmpio.h | 12 +- src/H5FDmulti.c | 1354 +- src/H5FDmulti.h | 20 +- src/H5FDpkg.h | 11 +- src/H5FDprivate.h | 130 +- src/H5FDpublic.h | 437 +- src/H5FDros3.c | 511 +- src/H5FDros3.h | 17 +- src/H5FDs3comms.c | 1198 +- src/H5FDs3comms.h | 148 +- src/H5FDsec2.c | 516 +- src/H5FDsec2.h | 5 +- src/H5FDspace.c | 153 +- src/H5FDsplitter.c | 538 +- src/H5FDsplitter.h | 15 +- src/H5FDstdio.c | 615 +- src/H5FDstdio.h | 4 +- src/H5FDtest.c | 19 +- src/H5FDwindows.c | 28 +- src/H5FDwindows.h | 3 +- src/H5FL.c | 871 +- src/H5FLmodule.h | 7 +- src/H5FLprivate.h | 301 +- src/H5FO.c | 138 +- src/H5FOprivate.h | 29 +- src/H5FS.c | 572 +- src/H5FScache.c | 524 +- src/H5FSdbg.c | 132 +- src/H5FSint.c | 35 +- src/H5FSmodule.h | 7 +- src/H5FSpkg.h | 197 +- src/H5FSprivate.h | 242 +- src/H5FSsection.c | 1122 +- src/H5FSstat.c | 35 +- src/H5FStest.c | 50 +- src/H5Faccum.c | 534 +- src/H5Fcwfs.c | 132 +- src/H5Fdbg.c | 89 +- src/H5Fdeprec.c | 72 +- src/H5Fefc.c | 343 +- src/H5Ffake.c | 32 +- src/H5Fint.c | 1592 +- src/H5Fio.c | 128 +- src/H5Fmodule.h | 7 +- src/H5Fmount.c | 351 +- src/H5Fmpi.c | 87 +- src/H5Fpkg.h | 498 +- src/H5Fprivate.h | 1175 +- src/H5Fpublic.h | 295 +- src/H5Fquery.c | 111 +- src/H5Fsfile.c | 53 +- src/H5Fspace.c | 50 +- src/H5Fsuper.c | 839 +- src/H5Fsuper_cache.c | 542 +- src/H5Ftest.c | 93 +- src/H5G.c | 298 +- src/H5Gbtree2.c | 153 +- src/H5Gcache.c | 111 +- src/H5Gcompact.c | 205 +- src/H5Gdense.c | 803 +- src/H5Gdeprec.c | 544 +- src/H5Gent.c | 197 +- src/H5Gint.c | 558 +- src/H5Glink.c | 187 +- src/H5Gloc.c | 431 +- src/H5Gmodule.h | 7 +- src/H5Gname.c | 585 +- src/H5Gnode.c | 662 +- src/H5Gobj.c | 570 +- src/H5Goh.c | 176 +- src/H5Gpkg.h | 382 +- src/H5Gprivate.h | 229 +- src/H5Gpublic.h | 135 +- src/H5Groot.c | 200 +- src/H5Gstab.c | 439 +- src/H5Gtest.c | 383 +- src/H5Gtraverse.c | 446 +- src/H5HF.c | 301 +- src/H5HFbtree2.c | 271 +- src/H5HFcache.c | 1377 +- src/H5HFdbg.c | 499 +- src/H5HFdblock.c | 334 +- src/H5HFdtable.c | 120 +- src/H5HFhdr.c | 628 +- src/H5HFhuge.c | 437 +- src/H5HFiblock.c | 909 +- src/H5HFiter.c | 229 +- src/H5HFman.c | 262 +- src/H5HFmodule.h | 7 +- src/H5HFpkg.h | 869 +- src/H5HFprivate.h | 113 +- src/H5HFsection.c | 1897 +- src/H5HFspace.c | 177 +- src/H5HFstat.c | 74 +- src/H5HFtest.c | 122 +- src/H5HFtiny.c | 102 +- src/H5HG.c | 330 +- src/H5HGcache.c | 154 +- src/H5HGdbg.c | 125 +- src/H5HGmodule.h | 7 +- src/H5HGpkg.h | 71 +- src/H5HGprivate.h | 38 +- src/H5HGquery.c | 21 +- src/H5HL.c | 1286 +- src/H5HLcache.c | 313 +- src/H5HLdbg.c | 150 +- src/H5HLdblk.c | 273 +- src/H5HLint.c | 138 +- src/H5HLmodule.h | 7 +- src/H5HLpkg.h | 96 +- src/H5HLprfx.c | 96 +- src/H5HLprivate.h | 28 +- src/H5HP.c | 395 +- src/H5HPprivate.h | 23 +- src/H5I.c | 763 +- src/H5Imodule.h | 7 +- src/H5Ipkg.h | 14 +- src/H5Iprivate.h | 63 +- src/H5Ipublic.h | 77 +- src/H5Itest.c | 51 +- src/H5L.c | 1630 +- src/H5Ldeprec.c | 312 +- src/H5Lexternal.c | 309 +- src/H5Lmodule.h | 8 +- src/H5Lpkg.h | 53 +- src/H5Lprivate.h | 77 +- src/H5Lpublic.h | 236 +- src/H5M.c | 364 +- src/H5MF.c | 1606 +- src/H5MFaggr.c | 1361 +- src/H5MFdbg.c | 158 +- src/H5MFmodule.h | 7 +- src/H5MFpkg.h | 141 +- src/H5MFprivate.h | 20 +- src/H5MFsection.c | 454 +- src/H5MM.c | 204 +- src/H5MMprivate.h | 27 +- src/H5MMpublic.h | 1 - src/H5MP.c | 186 +- src/H5MPmodule.h | 7 +- src/H5MPpkg.h | 45 +- src/H5MPprivate.h | 15 +- src/H5MPtest.c | 42 +- src/H5Mmodule.h | 8 +- src/H5Mpkg.h | 4 - src/H5Mprivate.h | 33 +- src/H5Mpublic.h | 75 +- src/H5O.c | 619 +- src/H5Oainfo.c | 221 +- src/H5Oalloc.c | 1457 +- src/H5Oattr.c | 412 +- src/H5Oattribute.c | 902 +- src/H5Obogus.c | 134 +- src/H5Obtreek.c | 120 +- src/H5Ocache.c | 668 +- src/H5Ocache_image.c | 147 +- src/H5Ochunk.c | 131 +- src/H5Ocont.c | 109 +- src/H5Ocopy.c | 859 +- src/H5Ocopy_ref.c | 299 +- src/H5Odbg.c | 319 +- src/H5Odeprec.c | 543 +- src/H5Odrvinfo.c | 132 +- src/H5Odtype.c | 1319 +- src/H5Oefl.c | 316 +- src/H5Ofill.c | 535 +- src/H5Oflush.c | 187 +- src/H5Ofsinfo.c | 216 +- src/H5Oginfo.c | 171 +- src/H5Oint.c | 1099 +- src/H5Olayout.c | 606 +- src/H5Olinfo.c | 271 +- src/H5Olink.c | 421 +- src/H5Omessage.c | 735 +- src/H5Omodule.h | 7 +- src/H5Omtime.c | 217 +- src/H5Oname.c | 121 +- src/H5Onull.c | 49 +- src/H5Opkg.h | 560 +- src/H5Opline.c | 410 +- src/H5Oprivate.h | 872 +- src/H5Opublic.h | 284 +- src/H5Orefcount.c | 125 +- src/H5Osdspace.c | 311 +- src/H5Oshared.c | 278 +- src/H5Oshared.h | 135 +- src/H5Oshmesg.c | 99 +- src/H5Ostab.c | 184 +- src/H5Otest.c | 376 +- src/H5Ounknown.c | 54 +- src/H5P.c | 531 +- src/H5PB.c | 738 +- src/H5PBmodule.h | 6 +- src/H5PBpkg.h | 17 +- src/H5PBprivate.h | 59 +- src/H5PL.c | 66 +- src/H5PLextern.h | 11 +- src/H5PLint.c | 102 +- src/H5PLmodule.h | 8 +- src/H5PLpath.c | 164 +- src/H5PLpkg.h | 106 +- src/H5PLplugin_cache.c | 89 +- src/H5PLprivate.h | 15 +- src/H5PLpublic.h | 35 +- src/H5Pacpl.c | 32 +- src/H5Pdapl.c | 649 +- src/H5Pdcpl.c | 2023 +- src/H5Pdeprec.c | 184 +- src/H5Pdxpl.c | 906 +- src/H5Pencdec.c | 228 +- src/H5Pfapl.c | 2615 +- src/H5Pfcpl.c | 695 +- src/H5Pfmpl.c | 65 +- src/H5Pgcpl.c | 252 +- src/H5Pint.c | 2375 +- src/H5Plapl.c | 529 +- src/H5Plcpl.c | 92 +- src/H5Pmapl.c | 120 +- src/H5Pmcpl.c | 55 +- src/H5Pmodule.h | 7 +- src/H5Pocpl.c | 748 +- src/H5Pocpypl.c | 364 +- src/H5Ppkg.h | 163 +- src/H5Pprivate.h | 170 +- src/H5Ppublic.h | 561 +- src/H5Pstrcpl.c | 104 +- src/H5Ptest.c | 36 +- src/H5R.c | 501 +- src/H5RS.c | 70 +- src/H5RSprivate.h | 13 +- src/H5Rdeprec.c | 413 +- src/H5Rint.c | 625 +- src/H5Rmodule.h | 7 +- src/H5Rpkg.h | 99 +- src/H5Rprivate.h | 8 +- src/H5Rpublic.h | 61 +- src/H5S.c | 647 +- src/H5SL.c | 1232 +- src/H5SLmodule.h | 7 +- src/H5SLprivate.h | 40 +- src/H5SM.c | 1310 +- src/H5SMbtree2.c | 77 +- src/H5SMcache.c | 261 +- src/H5SMmessage.c | 111 +- src/H5SMmodule.h | 7 +- src/H5SMpkg.h | 177 +- src/H5SMprivate.h | 36 +- src/H5SMtest.c | 45 +- src/H5ST.c | 186 +- src/H5STprivate.h | 35 +- src/H5Sall.c | 187 +- src/H5Sdbg.c | 34 +- src/H5Sdeprec.c | 34 +- src/H5Shyper.c | 5545 ++-- src/H5Smodule.h | 7 +- src/H5Smpio.c | 925 +- src/H5Snone.c | 170 +- src/H5Spkg.h | 265 +- src/H5Spoint.c | 781 +- src/H5Sprivate.h | 344 +- src/H5Spublic.h | 247 +- src/H5Sselect.c | 1030 +- src/H5Stest.c | 136 +- src/H5T.c | 3736 +-- src/H5TS.c | 98 +- src/H5TSprivate.h | 110 +- src/H5Tarray.c | 146 +- src/H5Tbit.c | 138 +- src/H5Tcommit.c | 512 +- src/H5Tcompound.c | 231 +- src/H5Tconv.c | 6330 ++-- src/H5Tcset.c | 49 +- src/H5Tdbg.c | 106 +- src/H5Tdeprec.c | 85 +- src/H5Tenum.c | 304 +- src/H5Tfields.c | 350 +- src/H5Tfixed.c | 42 +- src/H5Tfloat.c | 202 +- src/H5Tmodule.h | 7 +- src/H5Tnative.c | 1013 +- src/H5Toffset.c | 89 +- src/H5Toh.c | 88 +- src/H5Topaque.c | 35 +- src/H5Torder.c | 117 +- src/H5Tpad.c | 33 +- src/H5Tpkg.h | 1472 +- src/H5Tprecis.c | 95 +- src/H5Tprivate.h | 124 +- src/H5Tpublic.h | 586 +- src/H5Tref.c | 604 +- src/H5Tstrpad.c | 37 +- src/H5Tvisit.c | 60 +- src/H5Tvlen.c | 349 +- src/H5UC.c | 26 +- src/H5UCprivate.h | 14 +- src/H5VL.c | 238 +- src/H5VLcallback.c | 3223 +- src/H5VLconnector.h | 382 +- src/H5VLconnector_passthru.h | 193 +- src/H5VLint.c | 830 +- src/H5VLmodule.h | 7 +- src/H5VLnative.c | 322 +- src/H5VLnative.h | 112 +- src/H5VLnative_attr.c | 626 +- src/H5VLnative_blob.c | 171 +- src/H5VLnative_dataset.c | 710 +- src/H5VLnative_datatype.c | 154 +- src/H5VLnative_file.c | 1065 +- src/H5VLnative_group.c | 296 +- src/H5VLnative_introspect.c | 10 +- src/H5VLnative_link.c | 480 +- src/H5VLnative_object.c | 790 +- src/H5VLnative_private.h | 148 +- src/H5VLnative_token.c | 34 +- src/H5VLpassthru.c | 1277 +- src/H5VLpassthru.h | 16 +- src/H5VLpkg.h | 35 +- src/H5VLprivate.h | 212 +- src/H5VLpublic.h | 70 +- src/H5VM.c | 701 +- src/H5VMprivate.h | 313 +- src/H5WB.c | 63 +- src/H5WBprivate.h | 10 +- src/H5Z.c | 564 +- src/H5Zdeflate.c | 169 +- src/H5Zfletcher32.c | 93 +- src/H5Zmodule.h | 7 +- src/H5Znbit.c | 1302 +- src/H5Zpkg.h | 3 +- src/H5Zprivate.h | 80 +- src/H5Zpublic.h | 132 +- src/H5Zscaleoffset.c | 2190 +- src/H5Zshuffle.c | 308 +- src/H5Zszip.c | 217 +- src/H5Ztrans.c | 1358 +- src/H5api_adpt.h | 325 +- src/H5checksum.c | 210 +- src/H5dbg.c | 45 +- src/H5detect.c | 1135 +- src/H5make_libsettings.c | 96 +- src/H5mpi.c | 137 +- src/H5private.h | 2630 +- src/H5public.h | 367 +- src/H5system.c | 400 +- src/H5timer.c | 148 +- src/H5trace.c | 1379 +- src/H5win32defs.h | 245 +- src/hdf5.h | 68 +- test/H5srcdir.h | 1 - test/accum.c | 1352 +- test/accum_swmr_reader.c | 72 +- test/app_ref.c | 122 +- test/atomic_reader.c | 121 +- test/atomic_writer.c | 63 +- test/big.c | 497 +- test/bittests.c | 1205 +- test/btree2.c | 6008 ++-- test/cache.c | 36115 +++++++++++------------ test/cache_api.c | 1833 +- test/cache_common.c | 3889 +-- test/cache_common.h | 1209 +- test/cache_image.c | 4115 ++- test/cache_logging.c | 101 +- test/cache_tagging.c | 3034 +- test/chunk_info.c | 1312 +- test/cmpd_dset.c | 1952 +- test/cork.c | 1471 +- test/cross_read.c | 189 +- test/dangle.c | 392 +- test/del_many_dense_attrs.c | 96 +- test/direct_chunk.c | 1585 +- test/dsets.c | 12387 ++++---- test/dt_arith.c | 5668 ++-- test/dtransform.c | 960 +- test/dtypes.c | 6286 ++-- test/earray.c | 1475 +- test/efc.c | 2718 +- test/enc_dec_plist.c | 452 +- test/enc_dec_plist_cross_platform.c | 101 +- test/enum.c | 710 +- test/err_compat.c | 241 +- test/error_test.c | 215 +- test/evict_on_close.c | 515 +- test/extend.c | 261 +- test/external.c | 935 +- test/external_common.c | 49 +- test/external_common.h | 9 +- test/external_env.c | 117 +- test/external_fname.h | 12 +- test/farray.c | 771 +- test/fheap.c | 9929 ++++--- test/file_image.c | 634 +- test/filenotclosed.c | 65 +- test/fillval.c | 2434 +- test/filter_fail.c | 279 +- test/filter_plugin.c | 328 +- test/filter_plugin1_dsets.c | 47 +- test/filter_plugin2_dsets.c | 46 +- test/filter_plugin3_dsets.c | 55 +- test/filter_plugin4_groups.c | 56 +- test/flush1.c | 183 +- test/flush2.c | 209 +- test/flushrefresh.c | 1067 +- test/freespace.c | 1947 +- test/gen_bad_compound.c | 22 +- test/gen_bad_offset.c | 69 +- test/gen_bad_ohdr.c | 66 +- test/gen_bogus.c | 107 +- test/gen_bounds.c | 764 +- test/gen_cross.c | 672 +- test/gen_deflate.c | 61 +- test/gen_file_image.c | 44 +- test/gen_filespace.c | 79 +- test/gen_filters.c | 180 +- test/gen_mergemsg.c | 50 +- test/gen_new_array.c | 68 +- test/gen_new_fill.c | 87 +- test/gen_new_group.c | 76 +- test/gen_new_mtime.c | 13 +- test/gen_new_super.c | 16 +- test/gen_noencoder.c | 29 +- test/gen_nullspace.c | 20 +- test/gen_old_array.c | 71 +- test/gen_old_group.c | 26 +- test/gen_old_layout.c | 30 +- test/gen_old_mtime.c | 14 +- test/gen_plist.c | 383 +- test/gen_sizes_lheap.c | 15 +- test/gen_specmetaread.c | 26 +- test/gen_udlinks.c | 104 +- test/genall5.c | 1189 +- test/genall5.h | 4 +- test/getname.c | 3371 ++- test/gheap.c | 317 +- test/h5test.c | 834 +- test/h5test.h | 271 +- test/hdfs.c | 754 +- test/hyperslab.c | 863 +- test/istore.c | 512 +- test/lheap.c | 103 +- test/links.c | 18310 +++++++----- test/links_env.c | 108 +- test/mf.c | 4637 +-- test/mirror_vfd.c | 1213 +- test/mount.c | 3241 +- test/mtime.c | 117 +- test/ntypes.c | 2230 +- test/null_vol_connector.c | 210 +- test/null_vol_connector.h | 5 +- test/objcopy.c | 13512 +++++---- test/objcopy_ref.c | 1584 +- test/ohdr.c | 1575 +- test/page_buffer.c | 1294 +- test/pool.c | 368 +- test/reserved.c | 363 +- test/ros3.c | 882 +- test/s3comms.c | 1661 +- test/set_extent.c | 1886 +- test/space_overflow.c | 15 +- test/stab.c | 1093 +- test/swmr.c | 4235 ++- test/swmr_addrem_writer.c | 182 +- test/swmr_check_compat_vfd.c | 7 +- test/swmr_common.c | 87 +- test/swmr_common.h | 32 +- test/swmr_generator.c | 173 +- test/swmr_reader.c | 240 +- test/swmr_remove_reader.c | 227 +- test/swmr_remove_writer.c | 150 +- test/swmr_sparse_reader.c | 188 +- test/swmr_sparse_writer.c | 194 +- test/swmr_start_write.c | 253 +- test/swmr_writer.c | 186 +- test/tarray.c | 1164 +- test/tattr.c | 3760 +-- test/tcheck_version.c | 70 +- test/tchecksum.c | 44 +- test/tconfig.c | 47 +- test/tcoords.c | 392 +- test/testframe.c | 331 +- test/testhdf5.c | 45 +- test/testhdf5.h | 274 +- test/testmeta.c | 108 +- test/tfile.c | 2620 +- test/tgenprop.c | 783 +- test/th5o.c | 400 +- test/th5s.c | 1283 +- test/theap.c | 516 +- test/thread_id.c | 56 +- test/tid.c | 365 +- test/timer.c | 151 +- test/titerate.c | 560 +- test/tmeta.c | 106 +- test/tmisc.c | 2169 +- test/trefer.c | 949 +- test/trefer_deprec.c | 627 +- test/trefer_shutdown.c | 2 +- test/trefstr.c | 167 +- test/tselect.c | 12065 ++++---- test/tskiplist.c | 1007 +- test/tsohm.c | 1459 +- test/ttime.c | 96 +- test/ttsafe.c | 42 +- test/ttsafe.h | 26 +- test/ttsafe_acreate.c | 72 +- test/ttsafe_attr_vlen.c | 53 +- test/ttsafe_cancel.c | 117 +- test/ttsafe_dcreate.c | 82 +- test/ttsafe_error.c | 68 +- test/ttst.c | 220 +- test/tunicode.c | 1128 +- test/tvlstr.c | 382 +- test/tvltypes.c | 1793 +- test/twriteorder.c | 237 +- test/unlink.c | 2406 +- test/unregister.c | 182 +- test/use.h | 66 +- test/use_append_chunk.c | 51 +- test/use_append_chunk_mirror.c | 74 +- test/use_append_mchunks.c | 57 +- test/use_common.c | 306 +- test/use_disable_mdc_flushes.c | 483 +- test/vds.c | 8414 +++--- test/vds_env.c | 234 +- test/vds_swmr.h | 20 +- test/vds_swmr_gen.c | 157 +- test/vds_swmr_reader.c | 98 +- test/vds_swmr_writer.c | 98 +- test/vfd.c | 1686 +- test/vol.c | 485 +- test/vol_plugin.c | 167 +- testpar/t_2Gio.c | 2758 +- testpar/t_bigio.c | 1801 +- testpar/t_cache.c | 5147 ++-- testpar/t_cache_image.c | 2460 +- testpar/t_chunk_alloc.c | 243 +- testpar/t_coll_chunk.c | 1191 +- testpar/t_coll_md_read.c | 211 +- testpar/t_dset.c | 2481 +- testpar/t_file.c | 474 +- testpar/t_file_image.c | 285 +- testpar/t_filter_read.c | 406 +- testpar/t_filters_parallel.c | 3533 +-- testpar/t_filters_parallel.h | 301 +- testpar/t_init_term.c | 31 +- testpar/t_mdset.c | 1675 +- testpar/t_mpi.c | 618 +- testpar/t_pflush1.c | 105 +- testpar/t_pflush2.c | 115 +- testpar/t_ph5basic.c | 28 +- testpar/t_pread.c | 1105 +- testpar/t_prestart.c | 89 +- testpar/t_prop.c | 179 +- testpar/t_pshutdown.c | 76 +- testpar/t_shapesame.c | 3309 +-- testpar/t_span_tree.c | 2661 +- testpar/testpar.h | 97 +- testpar/testphdf5.c | 514 +- testpar/testphdf5.h | 297 +- tools/lib/h5diff.c | 1223 +- tools/lib/h5diff.h | 155 +- tools/lib/h5diff_array.c | 2365 +- tools/lib/h5diff_attr.c | 334 +- tools/lib/h5diff_dset.c | 608 +- tools/lib/h5diff_util.c | 327 +- tools/lib/h5tools.c | 836 +- tools/lib/h5tools.h | 416 +- tools/lib/h5tools_dump.c | 3116 +- tools/lib/h5tools_dump.h | 100 +- tools/lib/h5tools_error.h | 262 +- tools/lib/h5tools_filters.c | 182 +- tools/lib/h5tools_ref.c | 99 +- tools/lib/h5tools_ref.h | 1 - tools/lib/h5tools_str.c | 1024 +- tools/lib/h5tools_str.h | 45 +- tools/lib/h5tools_type.c | 10 +- tools/lib/h5tools_utils.c | 411 +- tools/lib/h5tools_utils.h | 96 +- tools/lib/h5trav.c | 542 +- tools/lib/h5trav.h | 94 +- tools/lib/io_timer.c | 116 +- tools/lib/io_timer.h | 46 +- tools/lib/ph5diff.h | 33 +- tools/libtest/h5tools_test_utils.c | 768 +- tools/src/h5copy/h5copy.c | 338 +- tools/src/h5diff/h5diff_common.c | 914 +- tools/src/h5diff/h5diff_common.h | 5 +- tools/src/h5diff/h5diff_main.c | 54 +- tools/src/h5diff/ph5diff_main.c | 120 +- tools/src/h5dump/h5dump.c | 1416 +- tools/src/h5dump/h5dump.h | 102 +- tools/src/h5dump/h5dump_ddl.c | 1500 +- tools/src/h5dump/h5dump_ddl.h | 29 +- tools/src/h5dump/h5dump_defines.h | 57 +- tools/src/h5dump/h5dump_extern.h | 97 +- tools/src/h5dump/h5dump_xml.c | 3038 +- tools/src/h5dump/h5dump_xml.h | 18 +- tools/src/h5format_convert/h5format_convert.c | 259 +- tools/src/h5import/h5import.c | 4984 ++-- tools/src/h5import/h5import.h | 196 +- tools/src/h5jam/h5jam.c | 313 +- tools/src/h5jam/h5unjam.c | 201 +- tools/src/h5ls/h5ls.c | 1227 +- tools/src/h5repack/h5repack.c | 225 +- tools/src/h5repack/h5repack.h | 199 +- tools/src/h5repack/h5repack_copy.c | 1485 +- tools/src/h5repack/h5repack_filters.c | 311 +- tools/src/h5repack/h5repack_main.c | 410 +- tools/src/h5repack/h5repack_opttable.c | 106 +- tools/src/h5repack/h5repack_parse.c | 314 +- tools/src/h5repack/h5repack_refs.c | 546 +- tools/src/h5repack/h5repack_verify.c | 366 +- tools/src/h5stat/h5stat.c | 1107 +- tools/src/misc/h5clear.c | 196 +- tools/src/misc/h5debug.c | 487 +- tools/src/misc/h5mkgrp.c | 126 +- tools/src/misc/h5repart.c | 334 +- tools/test/h5copy/dynlib_copy.c | 54 +- tools/test/h5copy/h5copygentest.c | 465 +- tools/test/h5diff/dynlib_diff.c | 54 +- tools/test/h5diff/h5diffgentest.c | 3663 ++- tools/test/h5dump/binread.c | 21 +- tools/test/h5dump/dynlib_dump.c | 54 +- tools/test/h5dump/h5dumpgentest.c | 6451 ++-- tools/test/h5format_convert/h5fc_chk_idx.c | 53 +- tools/test/h5format_convert/h5fc_gentest.c | 587 +- tools/test/h5import/h5importtest.c | 505 +- tools/test/h5jam/getub.c | 73 +- tools/test/h5jam/h5jamgentest.c | 395 +- tools/test/h5jam/tellub.c | 62 +- tools/test/h5ls/dynlib_ls.c | 54 +- tools/test/h5repack/dynlib_rpk.c | 58 +- tools/test/h5repack/dynlib_vrpk.c | 73 +- tools/test/h5repack/h5repackgentest.c | 183 +- tools/test/h5repack/h5repacktst.c | 3902 ++- tools/test/h5repack/testh5repack_detect_szip.c | 9 +- tools/test/h5stat/h5stat_gentest.c | 337 +- tools/test/misc/clear_open_chk.c | 10 +- tools/test/misc/h5clear_gentest.c | 312 +- tools/test/misc/h5perf_gentest.c | 654 +- tools/test/misc/h5repart_gentest.c | 50 +- tools/test/misc/repart_test.c | 50 +- tools/test/misc/talign.c | 114 +- tools/test/misc/vds/UC_1.h | 55 +- tools/test/misc/vds/UC_1_one_dim_gen.c | 177 +- tools/test/misc/vds/UC_2.h | 72 +- tools/test/misc/vds/UC_2_two_dims_gen.c | 192 +- tools/test/misc/vds/UC_3.h | 42 +- tools/test/misc/vds/UC_3_gaps_gen.c | 146 +- tools/test/misc/vds/UC_4.h | 38 +- tools/test/misc/vds/UC_4_printf_gen.c | 138 +- tools/test/misc/vds/UC_5.h | 31 +- tools/test/misc/vds/UC_5_stride_gen.c | 153 +- tools/test/misc/vds/UC_common.h | 19 +- tools/test/perform/chunk.c | 578 +- tools/test/perform/chunk_cache.c | 313 +- tools/test/perform/direct_write_perf.c | 430 +- tools/test/perform/iopipe.c | 188 +- tools/test/perform/overhead.c | 306 +- tools/test/perform/perf.c | 391 +- tools/test/perform/perf_meta.c | 618 +- tools/test/perform/pio_engine.c | 3628 +-- tools/test/perform/pio_perf.c | 1079 +- tools/test/perform/pio_perf.h | 86 +- tools/test/perform/pio_standalone.c | 114 +- tools/test/perform/pio_standalone.h | 676 +- tools/test/perform/sio_engine.c | 1166 +- tools/test/perform/sio_perf.c | 1038 +- tools/test/perform/sio_perf.h | 74 +- tools/test/perform/sio_standalone.c | 63 +- tools/test/perform/sio_standalone.h | 696 +- tools/test/perform/zip_perf.c | 342 +- utils/mirror_vfd/mirror_remote.c | 82 +- utils/mirror_vfd/mirror_remote.h | 23 +- utils/mirror_vfd/mirror_server.c | 197 +- utils/mirror_vfd/mirror_server_stop.c | 66 +- utils/mirror_vfd/mirror_writer.c | 314 +- 1118 files changed, 322298 insertions(+), 320102 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; jwrite(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 -#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(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 -#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 -#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 -#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 -#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, °ree); - if (ret_value < 0) - { + herr_t ret_value = H5Pget_fclose_degree(id, °ree); + 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 -#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 "::"; - // is returned by fromClass(). - H5std_string inMemFunc(const char* func_name) const; + // Makes and returns the string "::"; + // 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 #include -#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 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(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 -#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 (op_data); + H5std_string s_attr_name = H5std_string(attr_name); + UserData4Aiterate *myData = reinterpret_cast(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 (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(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(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(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(*_idx) : 0; - int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, static_cast(userData)); + int ret_value = + H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, userAttrOpWrpr, static_cast(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(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(userData), fields); + herr_t ret_value = + H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast(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(oinfo.num_attrs)); + return (static_cast(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(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 -#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 -#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(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.write(static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, + xfer); // Read the dataset back - dataset.read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.read(static_cast(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(out), PredType::STD_I32LE); + dataset.write(static_cast(out), PredType::STD_I32LE); // Read data with byte order conversion - dataset.read (static_cast(in), PredType::STD_I32BE); + dataset.read(static_cast(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(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(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read(static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - for (i=0; i(i) - << "," << static_cast(j) << endl; + cerr << " At index " << static_cast(i) << "," + << static_cast(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(n++); } } - dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write(static_cast(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(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read(static_cast(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; iwrite (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write(static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, + xfer); // Read the dataset back and check it - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read(static_cast(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(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset = new DataSet(file.openDataSet(DSET_COMPRESS_NAME)); + dataset->read(static_cast(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(points), PredType::NATIVE_INT, space1, space1, xfer); - dataset->read (static_cast(check), PredType::NATIVE_INT, space1, space1, xfer); + space1.selectHyperslab(H5S_SELECT_SET, hs_size, hs_offset); + dataset->write(static_cast(points), PredType::NATIVE_INT, space1, space1, xfer); + dataset->read(static_cast(check), PredType::NATIVE_INT, space1, space1, xfer); // Check that the values read are the same as the values written - for (i=0; i((hs_offset[0]+i)) << - "," << static_cast((hs_offset[1]+j)) << endl; - - cerr << " At original: " << static_cast(points[hs_offset[0]+i][hs_offset[1]+j]) << endl; - cerr << " At returned: " << static_cast(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((hs_offset[0] + i)) << "," + << static_cast((hs_offset[1] + j)) << endl; + + cerr << " At original: " + << static_cast(points[hs_offset[0] + i][hs_offset[1] + j]) << endl; + cerr << " At returned: " << static_cast(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(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write(static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, + xfer); + dataset->read(static_cast(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(i * j); orig_data[i][j].c = static_cast('a' + i); orig_data[i][j].s = static_cast(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(-orig_data[i][j].s); } } // Write to the dataset - dataset.write(static_cast(orig_data), mem_cmpd); + dataset.write(static_cast(orig_data), mem_cmpd); // Read the dataset back */ - dataset.read(static_cast(new_data), mem_cmpd); + dataset.read(static_cast(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(i), static_cast(j)); + printf(" At index %lu,%lu\n", static_cast(i), + static_cast(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(tmp_size[0]) - << " instead of " << static_cast(cur_size[0]) - << "!" << endl; + space->getSimpleExtentDims(tmp_size); + if (cur_size[0] != tmp_size[0]) { + cerr << " Got " << static_cast(tmp_size[0]) << " instead of " + << static_cast(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(0xff) ^ static_cast(i); + for (i = 0; i < sizeof buf; i++) + buf[i] = static_cast(0xff) ^ static_cast(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(0xff) ^ static_cast(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(0xff) ^ static_cast(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(0xff) ^ static_cast(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 -#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(i) << "," << - static_cast(j) << endl; + cerr << " At index " << static_cast(i) << "," << static_cast(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 - 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 - 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 - 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 - 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 } template - 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 -#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 -#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 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; iopenAttribute(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(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); - verify_val(min_dense, static_cast(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__); + verify_val(max_compact, static_cast(7), "DSetCreatPropList::getAttrPhaseChange", __LINE__, + __FILE__); + verify_val(min_dense, static_cast(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 -#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; ia = 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; ia != 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; ia = 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; ia != 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; ia = 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; ia != 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; ib = (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; ib != 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 -#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 -#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 -#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 -#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 -#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 -#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 -#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 (_op_data); + ovisit_ud_t *op_data = static_cast(_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 -#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 -#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; ireference(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, ) 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, ) 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 -#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; icommitted(); + 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(cmptyp.decode())); + CompType *decoded_cmp_ptr(static_cast(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(enumtyp.decode())); + EnumType *decoded_enum_ptr(static_cast(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(vlsttyp.decode())); + StrType *decoded_str_ptr(static_cast(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(arrtyp.decode())); + ArrayType *decoded_arr_ptr(static_cast(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(inttyp.decode())); + IntType * decoded_int_ptr(static_cast(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 -#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 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 #include - + #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 #include - /* "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 @@ -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 @@ -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 @@ -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 #include -#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 #include -#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 #include -#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 #include -#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 #include -#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 #include -#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 #include -#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 #include -#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 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 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 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,21 +2198,22 @@ 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 * NAME @@ -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_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 @@ -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 #include @@ -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 #include @@ -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 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(-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(-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(-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(-60), static_cast(-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(-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(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 #include -#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 @@ -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 @@ -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 #include - /*------------------------------------------------------------------------- * 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 @@ -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 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= (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, " "); + str = realloc_and_append(no_ubuf, str_len, str, tmp_str); + str = realloc_and_append(no_ubuf, str_len, str, " "); } /* 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 . 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 -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 /* 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 /* 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 /* 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 /* 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 /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* 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 /* 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 /* INFRINGES ON USER NAME SPACE */ +#elif defined _AIX +#define YYSTACK_ALLOC __alloca +#elif defined _MSC_VER +#include /* INFRINGES ON USER NAME SPACE */ +#define alloca _alloca +#else +#define YYSTACK_ALLOC alloca +#if !defined _ALLOCA_H && !defined EXIT_SUCCESS +#include /* 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 /* 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 /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif +#ifndef YYFPRINTF +#include /* 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 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 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 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 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 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= 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= 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) { - 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 #include @@ -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 ; iTableSize ; 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>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<= 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 #include #include @@ -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<= 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 \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 \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=\n"); - HDfprintf(stdout, " Display data for the fields specified in \n"); + HDfprintf(stdout, + " Display data for the fields specified in \n"); HDfprintf(stdout, " for a compound data type. 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 [//]\n"); @@ -669,11 +647,11 @@ usage(const char *prog) HDfprintf(stdout, " Path separated by slashes to the specified dataset\n"); HDfprintf(stdout, " 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= */ - 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= */ + 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, "", "(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, "", "(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; } -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls) { return H5G_GROUP; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1DATASET(JNIEnv *env, jclass cls) +{ + return H5G_DATASET; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls) { return H5G_LINK; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls) +{ + return H5G_GROUP; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls) { return H5G_UDLINK; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls) +{ + return H5G_LINK; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls) { return H5G_RESERVED_5; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls) +{ + return H5G_UDLINK; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls) { return H5G_RESERVED_6; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls) +{ + return H5G_RESERVED_5; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls) { return H5G_RESERVED_7; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls) +{ + return H5G_RESERVED_6; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls) { return H5G_TYPE; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls) +{ + return H5G_RESERVED_7; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls) { return H5G_UNKNOWN; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls) +{ + return H5G_TYPE; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls) { return H5G_LINK_ERROR; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls) +{ + return H5G_UNKNOWN; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1HARD(JNIEnv *env, jclass cls) { return H5G_LINK_HARD; } +Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls) +{ + return H5G_LINK_ERROR; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1SOFT(JNIEnv *env, jclass cls) { return H5G_LINK_SOFT; } +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; +} 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; } -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls) { return H5S_MAX_RANK; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) +{ + return H5S_ALL; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5S_NO_CLASS; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls) +{ + return H5S_MAX_RANK; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls) { return H5S_NULL; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls) +{ + return H5S_NO_CLASS; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls) { return H5S_SCALAR; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls) +{ + return H5S_NULL; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls) { return H5S_SEL_ALL; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls) +{ + return H5S_SCALAR; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls) { return H5S_SEL_ERROR; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls) +{ + return H5S_SEL_ALL; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls) { return H5S_SEL_HYPERSLABS; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls) +{ + return H5S_SEL_ERROR; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls) { return H5S_SEL_N; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls) +{ + return H5S_SEL_HYPERSLABS; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls) { return H5S_SEL_NONE; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls) +{ + return H5S_SEL_N; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls) { return H5S_SEL_POINTS; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls) +{ + return H5S_SEL_NONE; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls) { return H5S_SELECT_AND; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls) +{ + return H5S_SEL_POINTS; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_APPEND; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls) +{ + return H5S_SELECT_AND; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1INVALID(JNIEnv *env, jclass cls) { return H5S_SELECT_INVALID; } +Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls) +{ + return H5S_SELECT_APPEND; +} JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOOP(JNIEnv *env, jclass cls) { return H5S_SELECT_NOOP; } +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; +} 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, "", (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, "", (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=(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;