summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-03-01 17:09:01 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-03-01 17:09:01 (GMT)
commit9612b68b7d2b001a95cc2b48964a6a2fabe9af76 (patch)
tree8c3313456654bf28961362ef61b5a3d6db138df8
parent2804716f648c42d6bd85e1d4a942f7df204c93f2 (diff)
downloadhdf5-9612b68b7d2b001a95cc2b48964a6a2fabe9af76.zip
hdf5-9612b68b7d2b001a95cc2b48964a6a2fabe9af76.tar.gz
hdf5-9612b68b7d2b001a95cc2b48964a6a2fabe9af76.tar.bz2
Fix gif tool and h5dump
-rw-r--r--hl/tools/gif2h5/decompress.c50
-rw-r--r--hl/tools/gif2h5/gif.h131
-rw-r--r--hl/tools/gif2h5/gif2hdf.c6
-rw-r--r--hl/tools/gif2h5/gif2mem.c46
-rw-r--r--hl/tools/gif2h5/gifread.c92
-rw-r--r--hl/tools/gif2h5/hdf2gif.c34
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c2
-rw-r--r--hl/tools/gif2h5/writehdf.c6
-rw-r--r--tools/h5repack/h5repack_refs.c6
-rw-r--r--tools/lib/h5diff_util.c6
-rw-r--r--tools/lib/h5tools.h1
-rw-r--r--tools/lib/h5tools_dump.c85
-rw-r--r--tools/lib/h5tools_str.c25
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/testfiles/treference.ddl288
15 files changed, 515 insertions, 265 deletions
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index bd9a37d..8cd8a8e 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -15,13 +15,13 @@
#include "gif.h"
-WORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
+GIFWORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip;
unsigned long cols[256];
char *cmd;
FILE *fp;
-static WORD
+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 */
@@ -29,7 +29,7 @@ static WORD
IWidth, IHeight; /* image dimensions */
static int
BitOffset = 0, /* Bit Offset of next code */
- Pass = 0, /* Used by output routine if WORDerlaced pic */
+ 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 */
@@ -43,17 +43,17 @@ static int
ReadMask; /* Code AND mask for current code size */
/*MODIFICATIONS*/
-BYTE tempbyte[10];
-BYTE * tempBYTEptr[10];
-WORD tempint[10];
-WORD ImageCount = 0;
+GIFBYTE tempbyte[10];
+GIFBYTE * tempGIFBYTEptr[10];
+GIFWORD tempint[10];
+GIFWORD ImageCount = 0;
/*END MODIFICATION*/
boolean Interlace, HasColormap;
-BYTE *Image; /* The result array */
-BYTE *RawGIF; /* The heap array to hold it, raw */
-BYTE *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 */
@@ -70,10 +70,10 @@ int numused;
/*
* Fetch the next code from the raster data stream. The codes can be any
- * length from 3 to 12 bits, packed WORDo 8-bit BYTEs, so we have to maWORDain
- * our location in the Raster array as a BIT Offset. We compute the BYTE
- * Offset WORDo the raster array by dividing this by 8, pick up three BYTEs,
- * compute the bit Offset WORDo our 24-bit chunk, shift to bring the desired
+ * length from 3 to 12 bits, packed into 8-bit GIFBYTEs, so we have to maintain
+ * our location in the Raster array as a BIT Offset. We compute the GIFBYTE
+ * Offset into the raster array by dividing this by 8, pick up three GIFBYTEs,
+ * compute the bit Offset into our 24-bit chunk, shift to bring the desired
* code to the bottom, then mask it off and return it.
*/
static int
@@ -93,7 +93,7 @@ ReadCode(void)
}
static void
-AddToPixel(BYTE Index)
+AddToPixel(GIFBYTE Index)
{
if (YC<IHeight)
*(Image + YC * BytesPerScanline + XC) = Index;
@@ -104,8 +104,8 @@ AddToPixel(BYTE Index)
* Y-coordinate */
if (++XC == IWidth) {
/*
- * If a non-WORDerlaced picture, just increment YC to the next scan
- * line. If it's WORDerlaced, deal with the WORDerlace as described
+ * If a non-interlaced picture, just increment YC to the next scan
+ * line. If it's interlaced, deal with the interlace as described
* in the GIF spec. Put the decoded scan line out to the screen if we
* haven't gone past the bottom of it.
*/
@@ -154,7 +154,7 @@ AddToPixel(BYTE Index)
/* Main routine. Convert a GIF image to an HDF image */
-BYTE *
+GIFBYTE *
Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
{
int i;
@@ -183,7 +183,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
*/
/*
- * Start reading the raster data. First we get the WORDial code size and
+ * Start reading the raster data. First we get the intial code size and
* compute decompressor constant values, based on this code size.
*/
@@ -206,13 +206,13 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
/*
* Read the raster data. Here we just transpose it from the GIF array to
- * the Raster array, turning it from a series of blocks WORDo one long
+ * the Raster array, turning it from a series of blocks into one long
* data stream, which makes life much easier for ReadCode().
*/
/* Allocate the Image */
- if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
+ if (!(Image = (GIFBYTE *)malloc((size_t)IWidth*(size_t)IHeight))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
@@ -238,7 +238,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
FreeCode = FirstFree;
CurCode = OldCode = Code = ReadCode();
FinChar = CurCode & DataMask;
- AddToPixel((BYTE)FinChar);
+ AddToPixel((GIFBYTE)FinChar);
} else {
/*
* If not a clear code, then must be data: save same as CurCode
@@ -256,7 +256,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
}
/*
- * Unless this code is raw data, pursue the chain poWORDed to by
+ * Unless this code is raw data, pursue the chain pointed to by
* CurCode through the hash table to its end; each code in the
* chain puts its associated output code on the output queue.
*/
@@ -278,7 +278,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* stacked LIFO, so deal with it that way...
*/
for (i = OutCount - 1; i >= 0; i--)
- AddToPixel((BYTE)OutCode[i]);
+ AddToPixel((GIFBYTE)OutCode[i]);
OutCount = 0;
@@ -291,7 +291,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
OldCode = InCode;
/*
- * PoWORD to the next slot in the table. If we exceed the current
+ * Point to the next slot in the table. If we exceed the current
* MaxCode value, increment the code size unless it's already 12.
* If it is, do nothing: the next code decompressed better be
* CLEAR
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index ed1cc81..0c0f963 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -26,17 +26,24 @@
#define MAX_PAL 768
-/* typedef H5T_NATIVE_UINT8 BYTE; */
-typedef unsigned char BYTE;
+/* typedef H5T_NATIVE_UINT8 GIFBYTE; */
+typedef unsigned char GIFBYTE;
-/* typedef H5T_NATIVE_UINT16 WORD; */
-typedef unsigned long WORD;
+/* typedef H5T_NATIVE_UINT16 GIFWORD; */
+typedef unsigned long GIFWORD;
-typedef char CHAR;
+typedef char GIFCHAR;
+
+#ifndef boolean
typedef unsigned char boolean;
+#endif
+#ifndef false
#define false 0
+#endif
+#ifndef true
#define true 1
+#endif
/* Set the EndianOrder.
** The GIF Reader file should do this.
@@ -52,15 +59,15 @@ extern int EndianOrder;
** descriptor, and the global color table for the GIF image.
*/
typedef struct _GifHeader { /* Offset Description */
- BYTE PackedField; /* 0Ah Color Information */
- WORD TableSize;
- BYTE ImageCount; /* Keep a count of the number of images */
- BYTE CommentCount;
- BYTE ApplicationCount;
- BYTE PlainTextCount;
- BYTE HDFPalette[256][3];
- BYTE HeaderDump[6]; /* BYTE array to dump header contents */
- BYTE LSDDump[7]; /* Logical Screen Descriptor dump */
+ GIFBYTE PackedField; /* 0Ah Color Information */
+ GIFWORD TableSize;
+ 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 */
} GIFHEAD;
@@ -68,32 +75,32 @@ typedef struct _GifHeader { /* Offset Description */
** The GIF Image Descriptor.
*/
typedef struct _GifImageDescriptor {
- WORD ImageWidth; /* Width of the image in pixels */
- WORD ImageHeight; /* Height of the image in pixels */
- BYTE PackedField; /* Image and Color Table Data Information */
- WORD TableSize;
- WORD CodeSize; /* Minimum LZW CodeSize for image data */
- BYTE HDFPalette[256][3];
- BYTE GIDDump[9]; /* GifImageDescriptor dump */
-
- BYTE *Image; /* Decompressed Raster Image */
- BYTE *GIFImage;
+ 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 */
+ GIFBYTE HDFPalette[256][3];
+ GIFBYTE GIDDump[9]; /* GifImageDescriptor dump */
+
+ GIFBYTE *Image; /* Decompressed Raster Image */
+ GIFBYTE *GIFImage;
} GIFIMAGEDESC;
/*
** GIF 89a Graphic Control Extension Block
*/
typedef struct _GifGraphicControlExtension {
- BYTE GCEDump[5]; /* Graphic Control Extension Dump */
+ GIFBYTE GCEDump[5]; /* Graphic Control Extension Dump */
} GIFGRAPHICCONTROL;
/*
** GIF 89a Plain Text Extension Block
*/
typedef struct _GifPlainTextExtension {
- BYTE PTEDump[15]; /* Plain Text Extension Dump */
- BYTE *PlainTextData; /* Plain Text data sub-blocks */
- WORD DataSize;
+ GIFBYTE PTEDump[15]; /* Plain Text Extension Dump */
+ GIFBYTE *PlainTextData; /* Plain Text data sub-blocks */
+ GIFWORD DataSize;
} GIFPLAINTEXT;
@@ -101,19 +108,19 @@ typedef struct _GifPlainTextExtension {
** GIF 89a Application Extension Block
*/
typedef struct _GifApplicationExtension {
- BYTE AEDump[14]; /* Application Extension Dump */
- BYTE *ApplicationData; /* Application data sub-blocks */
- WORD DataSize;
+ GIFBYTE AEDump[14]; /* Application Extension Dump */
+ GIFBYTE *ApplicationData; /* Application data sub-blocks */
+ GIFWORD DataSize;
} GIFAPPLICATION;
/*
** GIF 89a Comment Extension Block
*/
typedef struct _GifCommentExtension {
- BYTE CEDump[2]; /* Comment Extension Dump */
- BYTE *CommentData; /* Comment data sub-blocks */
- WORD DataSize;
- BYTE 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;
/*
@@ -128,12 +135,12 @@ typedef struct _GifCommentExtension {
** extension.
*/
typedef struct _GifToMem {
- GIFHEAD *GifHeader;
- GIFIMAGEDESC **GifImageDesc;
- GIFGRAPHICCONTROL **GifGraphicControlExtension;
- GIFPLAINTEXT **GifPlainTextExtension;
- GIFAPPLICATION **GifApplicationExtension;
- GIFCOMMENT **GifCommentExtension;
+ GIFHEAD *GifHeader;
+ GIFIMAGEDESC **GifImageDesc;
+ GIFGRAPHICCONTROL **GifGraphicControlExtension;
+ GIFPLAINTEXT **GifPlainTextExtension;
+ GIFAPPLICATION **GifApplicationExtension;
+ GIFCOMMENT **GifCommentExtension;
} GIFTOMEM;
/*
@@ -141,40 +148,40 @@ typedef struct _GifToMem {
*/
/* GIF2MEM.C */
-int Gif2Mem(BYTE *, GIFTOMEM *);
+int Gif2Mem(GIFBYTE *, GIFTOMEM *);
/* GIFREAD.C */
-int ReadGifHeader(GIFHEAD *, BYTE **);
-int ReadGifImageDesc(GIFIMAGEDESC *, BYTE **);
-int ReadGifGraphicControl(GIFGRAPHICCONTROL *, BYTE **);
-int ReadGifPlainText(GIFPLAINTEXT *, BYTE **);
-int ReadGifApplication(GIFAPPLICATION *, BYTE **);
-int ReadGifComment(GIFCOMMENT *, BYTE **);
+int ReadGifHeader(GIFHEAD *, GIFBYTE **);
+int ReadGifImageDesc(GIFIMAGEDESC *, GIFBYTE **);
+int ReadGifGraphicControl(GIFGRAPHICCONTROL *, GIFBYTE **);
+int ReadGifPlainText(GIFPLAINTEXT *, GIFBYTE **);
+int ReadGifApplication(GIFAPPLICATION *, GIFBYTE **);
+int ReadGifComment(GIFCOMMENT *, GIFBYTE **);
/* HDFGIFWR.C */
-int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
- BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, int numcols,
+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 , CHAR * );
+int WriteHDF(GIFTOMEM , GIFCHAR * );
/* Function: ReadHDF
** Return: 0 on completion without error, -1 on error
-** Input: CHAR *h5_file - HDF file name
-** CHAR *dset_name - Name of the HDF Image dataset
-** CHAR *pal_name - Name of the HDF palette
-** Output: BYTE* data - the HDF Image to be converted
-** BYTE palette[256][3] - the corresponding palette
+** Input: GIFCHAR *h5_file - HDF file name
+** GIFCHAR *dset_name - Name of the HDF Image dataset
+** GIFCHAR *pal_name - Name of the HDF palette
+** Output: GIFBYTE* data - the HDF Image to be converted
+** GIFBYTE palette[256][3] - the corresponding palette
** hsize_t* image_size - the size of each dimension of the image
*/
-int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
- CHAR *h5_file, CHAR *dset_name, CHAR *pal_name);
+int ReadHDF(GIFBYTE** data, GIFBYTE palette[256][3], hsize_t *image_size,
+ GIFCHAR *h5_file, GIFCHAR *dset_name, GIFCHAR *pal_name);
-BYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
-BYTE GetByte(BYTE *);
-WORD GetWord(BYTE *);
+GIFBYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *);
+GIFBYTE GetByte(GIFBYTE *);
+GIFWORD GetWord(GIFBYTE *);
-void cleanup(BYTE*);
+void cleanup(GIFBYTE*);
#endif /* GIF_H_ */
diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c
index 2e06d34..051ff56 100644
--- a/hl/tools/gif2h5/gif2hdf.c
+++ b/hl/tools/gif2h5/gif2hdf.c
@@ -31,8 +31,8 @@ main(int argv , char *argc[])
long i, ImageCount;
long filesize;
- BYTE *MemGif;
- BYTE *StartPos;
+ GIFBYTE *MemGif;
+ GIFBYTE *StartPos;
char *GIFFileName;
char *HDFFileName;
@@ -81,7 +81,7 @@ main(int argv , char *argc[])
if (filesize == 0)
printf("File Size Zero");
- if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) {
+ if (!(MemGif = StartPos = (GIFBYTE *)malloc((size_t)filesize))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c
index 8fb575c..ae0a113 100644
--- a/hl/tools/gif2h5/gif2mem.c
+++ b/hl/tools/gif2h5/gif2mem.c
@@ -36,7 +36,7 @@
#include "gif.h"
int
-Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
+Gif2Mem(GIFBYTE *MemGif, GIFTOMEM *GifMemoryStruct)
{
/*
* The gif structure outline for passing data to memory is given in gif.h.
@@ -49,22 +49,22 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
GIFCOMMENT **gifComment; /* Comment Extension structure */
GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */
- register WORD i; /* Loop counter */
- BYTE Identifier; /* Extension block identifier holder */
- BYTE Label; /* Extension block label holder */
- BYTE ImageCount; /* Count of the number of images in the file */
- BYTE ImageArray; /* Keep the size of the array to store Images */
- BYTE CommentCount;
- BYTE CommentArray;
- BYTE ApplicationCount;
- BYTE ApplicationArray;
- BYTE PlainTextCount;
- BYTE PlainTextArray;
- BYTE GCEflag;
- BYTE aTemp;
- BYTE j;
- BYTE w; /* Two more variables needed only while testing */
- BYTE *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 */
@@ -90,7 +90,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
/* Carry out Endian Testing and set Endian Order */
w = 0x0001;
- b = (BYTE *) &w;
+ b = (GIFBYTE *) &w;
EndianOrder = (b[0] ? 1 : 0);
/* Read the GIF image file header information */
@@ -151,7 +151,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
if (ImageCount > ImageArray) {
aTemp = ImageArray;
- ImageArray = (BYTE)((ImageArray << 1) + 1);
+ ImageArray = (GIFBYTE)((ImageArray << 1) + 1);
if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc,
sizeof(GIFIMAGEDESC *) * ImageArray))) {
printf("Out of memory!");
@@ -218,7 +218,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
PlainTextCount++;
if (PlainTextCount > PlainTextArray)
- PlainTextArray = (BYTE)((PlainTextArray << 1) + 1);
+ PlainTextArray = (GIFBYTE)((PlainTextArray << 1) + 1);
if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) {
printf("Out of memory!");
@@ -240,7 +240,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
CommentCount++;
if (CommentCount > CommentArray)
- CommentArray = (BYTE)((CommentArray << 1) + 1);
+ CommentArray = (GIFBYTE)((CommentArray << 1) + 1);
if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) {
printf("Out of memory!");
@@ -267,7 +267,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
if (ImageCount > ImageArray) {
aTemp = ImageArray;
- ImageArray = (BYTE)((ImageArray << 1) + 1);
+ ImageArray = (GIFBYTE)((ImageArray << 1) + 1);
if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) {
printf("Out of memory!");
@@ -306,7 +306,7 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct)
ApplicationCount++;
if (ApplicationCount > ApplicationArray)
- ApplicationArray = (BYTE)((ApplicationArray << 1) + 1);
+ ApplicationArray = (GIFBYTE)((ApplicationArray << 1) + 1);
if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) {
printf("Out of memory!");
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index 948e112..79671aa 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -17,33 +17,33 @@
int EndianOrder;
-static BYTE *ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize);
+static GIFBYTE *ReadDataSubBlocks(GIFBYTE **MemGif2, GIFWORD *DSize);
-WORD
-GetWord(BYTE *MemGif)
+GIFWORD
+GetWord(GIFBYTE *MemGif)
{
- WORD w;
+ GIFWORD w;
if (EndianOrder == 1) {
/* LittleEndian */
- w = (WORD) (*MemGif++ & 0xFF);
- w |= (WORD) ((*MemGif++ & 0xFF) << 0x08);
+ w = (GIFWORD) (*MemGif++ & 0xFF);
+ w |= (GIFWORD) ((*MemGif++ & 0xFF) << 0x08);
} else {
- w = (WORD) (*MemGif++ & 0xFF);
- w = ((WORD) (*MemGif++ & 0xFF)) | (w << 0x08);
+ w = (GIFWORD) (*MemGif++ & 0xFF);
+ w = ((GIFWORD) (*MemGif++ & 0xFF)) | (w << 0x08);
}
return w;
}
-BYTE
-GetByte(BYTE *MemGif)
+GIFBYTE
+GetByte(GIFBYTE *MemGif)
{
return *MemGif;
}
/*
- * Read a GIF image BYTE Header.
+ * Read a GIF image GIFBYTE Header.
*
* This function reads the Header, Logical Screen Descriptor, and
* Global Color Table (if any) from a GIF image file. The information
@@ -54,10 +54,10 @@ GetByte(BYTE *MemGif)
*/
int
ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
- BYTE **MemGif2) /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2) /* GIF image file input FILE stream */
{
- WORD i; /* Loop counter */
- WORD 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++) {
@@ -78,7 +78,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 = (WORD) (1L << ((GifHead->PackedField & 0x07) + 1));
+ tableSize = (GIFWORD) (1L << ((GifHead->PackedField & 0x07) + 1));
GifHead->TableSize = tableSize;
/* Read the Global Color Table */
@@ -122,13 +122,13 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */
int
ReadGifImageDesc(
GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
- WORD i; /* Loop counter */
- WORD tableSize; /* Number of entries in the Local Color Table */
- /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
- BYTE *TempPtr;
+ 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;
@@ -145,20 +145,20 @@ ReadGifImageDesc(
if (EndianOrder == 1) /* LittleEndian */
{
- GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
+ GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth |= (GIFWORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
- GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
+ GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight |= (GIFWORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
}
else
{
- GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth = ((WORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ GifImageDesc->ImageWidth = (GIFWORD) (GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth = ((GIFWORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
- GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ GifImageDesc->ImageHeight = (GIFWORD) (GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight = ((GIFWORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
}
@@ -171,7 +171,7 @@ ReadGifImageDesc(
if (GifImageDesc->PackedField & 0x80)
{
/* Read number of color table entries */
- tableSize = (WORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
+ tableSize = (GIFWORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
GifImageDesc->TableSize = tableSize;
/* Read the Local Color Table */
for (i = 0; i < tableSize; i++)
@@ -185,10 +185,10 @@ ReadGifImageDesc(
/*
** Get LZW minimum Code Size
*/
- GifImageDesc->CodeSize = (WORD)*(*MemGif2)++;
+ GifImageDesc->CodeSize = (GIFWORD)*(*MemGif2)++;
/*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
- if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
+ if (!(GifImageDesc->GIFImage = (GIFBYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
printf("Out of memory");
exit(EXIT_FAILURE);
}
@@ -219,7 +219,7 @@ ReadGifImageDesc(
int
ReadGifGraphicControl(
GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
int i;
@@ -244,7 +244,7 @@ ReadGifGraphicControl(
int
ReadGifPlainText(
GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
int i;
@@ -283,7 +283,7 @@ ReadGifPlainText(
int
ReadGifApplication(
GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
int i;
@@ -321,7 +321,7 @@ ReadGifApplication(
int
ReadGifComment(
GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */
- BYTE **MemGif2 /* GIF image file input FILE stream */
+ GIFBYTE **MemGif2 /* GIF image file input FILE stream */
)
{
@@ -345,14 +345,14 @@ ReadGifComment(
** Returns: A NULL pointer if a memory allocation error occured,
** otherwise a valid pointer if no error occured.
*/
-static BYTE *
-ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream */
- WORD *DSize)
+static GIFBYTE *
+ReadDataSubBlocks(GIFBYTE **MemGif2, /* GIF image file input FILE stream */
+ GIFWORD *DSize)
{
- BYTE *ptr1; /* Pointer used to "walk the heap" */
- BYTE *ptr2; /* Pointer used to mark the top of the heap */
- BYTE dataSize; /* Size of the current data sub-block being read */
- WORD bufSize; /* Total size of the Plain Text data buffer */
+ 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;
bufSize = 0; /* The output buffer is empty */
@@ -360,9 +360,9 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream
dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */
/* Allocate initial data buffer */
- if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) {
+ 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((BYTE *) NULL);
+ return((GIFBYTE *) NULL);
}
for (;;)
{
@@ -381,8 +381,8 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream
break; /* Block Terminator encountered */
/* Increase the buffer size to accomodate the next sub-block */
- if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1)))
- return((BYTE *) NULL);
+ if (!(ptr1 = ptr2 = (GIFBYTE *) realloc(ptr2, bufSize + dataSize + 1)))
+ return((GIFBYTE *) NULL);
ptr1 += bufSize; /* Move pointer to the end of the data */
diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index ae63e92..e32facb 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -45,20 +45,20 @@ usage(void)
FILE *fpGif = NULL;
int main(int argc , char **argv)
{
- BYTE *Image;
+ GIFBYTE *Image;
void *edata;
H5E_auto2_t func;
/* compression structs */
- CHAR *HDFName = NULL;
- CHAR *GIFName = NULL;
+ GIFCHAR *HDFName = NULL;
+ GIFCHAR *GIFName = NULL;
- BYTE* b;
+ GIFBYTE* b;
- BYTE GlobalPalette[256][3];
- BYTE Red[256];
- BYTE Green[256];
- BYTE Blue[256];
+ GIFBYTE GlobalPalette[256][3];
+ GIFBYTE Red[256];
+ GIFBYTE Green[256];
+ GIFBYTE Blue[256];
int RWidth, RHeight;
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
@@ -66,7 +66,7 @@ int main(int argc , char **argv)
int i;
int numcols = 0;
- BYTE 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 */
@@ -110,7 +110,7 @@ int main(int argc , char **argv)
{
/* allocate space to store the image name */
size_t len = strlen(argv[arg_index]);
- image_name = (CHAR*) malloc( len + 1);
+ image_name = (GIFCHAR*) malloc( len + 1);
strcpy(image_name , argv[arg_index]);
bool_is_image = 0;
@@ -125,7 +125,7 @@ int main(int argc , char **argv)
/* Do Endian Order testing and set Endian Order */
idx = 0x0001;
- b = (BYTE *) &idx;
+ b = (GIFBYTE *) &idx;
EndianOrder = (b[0] ? 1:0);
if (!(fpGif = fopen(GIFName , "wb")))
@@ -164,7 +164,7 @@ int main(int argc , char **argv)
goto out;
}
- Image = (BYTE*) malloc( (size_t) width * (size_t) height );
+ Image = (GIFBYTE*) malloc( (size_t) width * (size_t) height );
if ( H5IMread_image( fid, image_name, Image ) < 0 )
goto out;
@@ -174,7 +174,7 @@ int main(int argc , char **argv)
if ( H5IMget_palette_info( fid, image_name, 0, pal_dims ) < 0 )
goto out;
- pal = (BYTE*) 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 )
goto out;
@@ -211,9 +211,9 @@ int main(int argc , char **argv)
numcols = 256;
for (i = 0 ; i < numcols ; i++)
{
- Red[i] = (BYTE)(255 - i);
- Green[i] = (BYTE)(255 - i);
- Blue[i] = (BYTE)(255 - i);
+ Red[i] = (GIFBYTE)(255 - i);
+ Green[i] = (GIFBYTE)(255 - i);
+ Blue[i] = (GIFBYTE)(255 - i);
}
}
else
@@ -246,7 +246,7 @@ int main(int argc , char **argv)
if (j==i)
{
/* wasn't found */
- pc2nc[i] = (BYTE)nc;
+ pc2nc[i] = (GIFBYTE)nc;
r1[nc] = Red[i];
g1[nc] = Green[i];
b1[nc] = Blue[i];
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index 6f5ab58..ed3e9e9 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -51,7 +51,7 @@
#include "gif.h"
-typedef BYTE byte;
+typedef GIFBYTE byte;
typedef long int count_int;
#ifdef __STDC__
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index b656c36..c2933c5 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -62,9 +62,9 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
/* get some data from gifHead */
ImageCount = gifHead.ImageCount;
#ifdef UNUSED
- CommentCount = (WORD)gifHead.CommentCount;
- ApplicationCount = (WORD)gifHead.ApplicationCount;
- PlainTextCount = (WORD)gifHead.PlainTextCount;
+ CommentCount = (GIFWORD)gifHead.CommentCount;
+ ApplicationCount = (GIFWORD)gifHead.ApplicationCount;
+ PlainTextCount = (GIFWORD)gifHead.PlainTextCount;
#endif /* UNUSED */
if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) {
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index 6f699fd..e4e9010 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -531,8 +531,8 @@ static int copy_refs_attr(hid_t loc_in,
ref_comp_size = NULL;
}
}
- /* This line below needs to be moved in this loop instead of inserting outside. Otherwise,
- ref_comp_field_n may be >0 for the next attribute, which may not be
+ /* This line below needs to be moved in this loop instead of inserting outside. Otherwise,
+ ref_comp_field_n may be >0 for the next attribute, which may not be
the reference type and will be accidently treated as the reference type.
It will then cause the H5Acreate2 failed since that attribute is already created.
KY 2020-02-05
@@ -836,7 +836,7 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
ref_obj_id = H5Rdereference(obj_id, ref_type, ref_in);
if (ref_obj_id < 0)
- H5TOOLS_GOTO_ERROR(FAIL, "H5Rdereference2 failed");
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Rdereference failed");
ref_obj_name = MapIdToName(ref_obj_id, travt);
if (ref_obj_name == NULL)
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 896301d..16169a2 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -185,7 +185,7 @@ void print_type(hid_t type)
* Purpose: Returns a pointer to the last component absolute name
*-------------------------------------------------------------------------
*/
- const char*
+const char*
diff_basename(const char *name)
{
size_t i;
@@ -242,7 +242,7 @@ get_type(h5trav_type_t type)
* Purpose: Returns the sign as a string
*-------------------------------------------------------------------------
*/
- const char*
+const char*
get_sign(H5T_sign_t sign)
{
switch(sign) {
@@ -270,7 +270,7 @@ get_sign(H5T_sign_t sign)
* Purpose: Returns the class as a string
*-------------------------------------------------------------------------
*/
- const char*
+const char*
get_class(H5T_class_t tclass)
{
switch(tclass) {
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 7229031..0e830c0 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -91,6 +91,7 @@
#define PACKED_BITS "PACKED_BITS"
#define PACKED_OFFSET "OFFSET"
#define PACKED_LENGTH "LENGTH"
+#define REGION "REGION"
#define BEGIN "{"
#define END "}"
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 4b338ef..f9560a0 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -3738,8 +3738,8 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
H5TOOLS_GOTO_DONE_NO_RET();
}
}
- for (i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) {
- void* memref = region_buf + i * nsize;
+ for (i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) {
+ void *memref = region_buf + i * nsize;
H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos);
@@ -3749,51 +3749,70 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
h5tools_str_sprint(&buffer, &outputformat, obj_id, f_type, memref, &datactx);
h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- if (h5tools_is_zero(memref, nsize)) {
- H5TOOLS_DEBUG("NULL H5R_DATASET_REGION");
+ if ((region_id = H5Rdereference(obj_id, H5R_OBJECT, memref)) >= 0) {
+ datactx.indent_level++;
+ h5tools_dump_data(stream, &outputformat, &datactx, region_id, TRUE);
+ datactx.indent_level--;
}
else {
- /* region data */
- region_id = H5Rdereference(obj_id, H5R_DATASET_REGION, memref);
- if (region_id >= 0) {
- region_space = H5Rget_region(obj_id, H5R_DATASET_REGION, memref);
- if (region_space >= 0) {
- H5S_sel_type region_type;
-
- region_type = H5Sget_select_type(region_space);
- if(region_type == H5S_SEL_POINTS) {
- /* Print point information */
- H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION");
- h5tools_dump_region_data_points(
- region_space, region_id, stream, &outputformat, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
- }
- else if(region_type == H5S_SEL_HYPERSLABS) {
- /* Print block information */
- H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION");
- h5tools_dump_region_data_blocks(
- region_space, region_id, stream, &outputformat, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
+ if ((region_id = H5Rdereference(obj_id, H5R_DATASET_REGION, memref)) >= 0) {
+ if ((region_space = H5Rget_region(obj_id, H5R_DATASET_REGION, memref)) >= 0) {
+ if (h5tools_is_zero(memref, H5Tget_size(f_type))) {
+ H5TOOLS_DEBUG("NULL H5R_DATASET_REGION");
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " {");
+ h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+
+ datactx.need_prefix = TRUE;
+ datactx.indent_level++;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "NULL");
+ h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ datactx.indent_level--;
+ datactx.need_prefix = TRUE;
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "}");
+ h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5TOOLS_INFO("invalid region type");
- }
+ H5S_sel_type region_type;
+
+ region_type = H5Sget_select_type(region_space);
+ if(region_type == H5S_SEL_POINTS) {
+ /* Print point information */
+ H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION");
+ h5tools_dump_region_data_points(
+ region_space, region_id, stream, &outputformat, &datactx,
+ &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
+ }
+ else if(region_type == H5S_SEL_HYPERSLABS) {
+ /* Print block information */
+ H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION");
+ h5tools_dump_region_data_blocks(
+ region_space, region_id, stream, &outputformat, &datactx,
+ &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
+ }
+ else
+ H5TOOLS_INFO("invalid region type");
+ } /* end else to if (h5tools_is_zero(... */
if(H5Sclose(region_space) < 0)
- H5TOOLS_INFO("H5Sclose failed");
+ H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION failed");
} /* end if (region_space >= 0) */
else
- H5TOOLS_INFO("H5Rget_region failed");
+ H5TOOLS_INFO("H5Rget_region H5R_DATASET_REGION failed");
if(H5Dclose(region_id) < 0)
- H5TOOLS_INFO("H5Dclose failed");
-
+ H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION failed");
} /* if (region_id >= 0) */
else {
/* if (region_id < 0) - could mean that no reference was written do not throw failure */
H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference failed");
}
- } /* end else to if (h5tools_is_zero(... */
+ }
+
H5TOOLS_DEBUG("finished reference loop:%d",i);
- } /* end for (i = 0; i < nelmts... */
+ } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */
HDfree(region_buf);
}
ctx->indent_level--;
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 7939e69..cc6397d 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -892,11 +892,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
break;
case H5T_COMPOUND:
+ H5TOOLS_DEBUG("H5T_COMPOUND");
{
unsigned nmembs;
unsigned j;
- H5TOOLS_DEBUG("H5T_COMPOUND");
nmembs = (unsigned)H5Tget_nmembers(type);
h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
@@ -959,7 +959,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else {
if(nsize == H5R_DSET_REG_REF_BUF_SIZE) {
/* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */
- H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
+ H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG");
h5tools_str_append(str, H5_TOOLS_DATASET);
h5tools_str_sprint_reference(str, container, vp);
}
@@ -969,9 +969,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
* Object references -- show the type and OID of the referenced object.
*/
H5O_info_t oi;
- const char *path;
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT");
+ H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ");
obj = H5Rdereference(container, H5R_OBJECT, vp);
H5Oget_info(obj, &oi);
@@ -1003,13 +1002,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else
h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
- /* Print name */
- path = lookup_ref_path(*(haddr_t *) vp);
- if(path) {
- h5tools_str_append(str, " ");
- h5tools_str_append(str, path);
- h5tools_str_append(str, " ");
- } /* end if */
+ h5tools_str_sprint_reference(str, container, vp);
} /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */
}
break;
@@ -1170,6 +1163,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp)
hid_t obj = H5I_INVALID_HID;
hid_t region = H5I_INVALID_HID;
char ref_name[1024];
+ const char *path;
H5TOOLS_START_DEBUG("");
@@ -1179,19 +1173,24 @@ h5tools_str_sprint_reference(h5tools_str_t *str, hid_t container, void *vp)
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
if(region >= 0) {
H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*) ref_name, 1024);
-
h5tools_str_append(str, "%s", ref_name);
H5Sclose(region);
} /* end if (region >= 0) */
H5Dclose(obj);
} /* end if (obj >= 0) */
+ else {
+ /* Print name */
+ path = lookup_ref_path(*(haddr_t *) vp);
+ if(path) {
+ h5tools_str_append(str, path);
+ } /* end if */
+ }
h5tools_str_append(str, "\"");
H5TOOLS_ENDDEBUG("");
}
-
/*-------------------------------------------------------------------------
* Function: h5tools_escape
*
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 2dbb5c6..0bfe825 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -680,7 +680,7 @@ dump_tables(find_objs_t *info)
* Failure: FAIL if object is not found
*-------------------------------------------------------------------------
*/
- obj_t *
+obj_t *
search_obj(table_t *table, haddr_t objno)
{
unsigned u;
diff --git a/tools/testfiles/treference.ddl b/tools/testfiles/treference.ddl
index 4683ce5..3e133b6 100644
--- a/tools/testfiles/treference.ddl
+++ b/tools/testfiles/treference.ddl
@@ -847,34 +847,146 @@ GROUP "/" {
DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
DATA {
- (0): DATASET 976 /dset , DATASET 976 /dset
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
}
}
ATTRIBUTE "reference2D" {
DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) }
DATA {
- (0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,0): DATASET 976 /dset , DATASET 976 /dset
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
}
}
ATTRIBUTE "reference3D" {
DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) }
DATA {
- (0,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (0,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (0,2,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,2,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,2,0): DATASET 976 /dset , DATASET 976 /dset ,
- (3,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (3,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (3,2,0): DATASET 976 /dset , DATASET 976 /dset
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
}
}
ATTRIBUTE "string" {
@@ -1805,34 +1917,146 @@ GROUP "/" {
DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
DATA {
- (0): DATASET 976 /dset , DATASET 976 /dset
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
}
}
DATASET "reference2D" {
DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) }
DATA {
- (0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,0): DATASET 976 /dset , DATASET 976 /dset
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
}
}
DATASET "reference3D" {
DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
DATASPACE SIMPLE { ( 4, 3, 2 ) / ( 4, 3, 2 ) }
DATA {
- (0,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (0,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (0,2,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (1,2,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (2,2,0): DATASET 976 /dset , DATASET 976 /dset ,
- (3,0,0): DATASET 976 /dset , DATASET 976 /dset ,
- (3,1,0): DATASET 976 /dset , DATASET 976 /dset ,
- (3,2,0): DATASET 976 /dset , DATASET 976 /dset
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
+ DATASET 976 "/dset"
+ DATA {
+ (0): 0, 0
+ }
}
}
DATASET "string" {