diff options
author | David Young <dyoung@hdfgroup.org> | 2019-12-19 20:55:49 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2019-12-19 20:55:49 (GMT) |
commit | d11b347aa77cbcfa2bf782c8856bf559444ad880 (patch) | |
tree | df43489411575f566e0475ad4bb040dc69f623e6 /hl/tools/gif2h5/gifread.c | |
parent | 4281d101c41f80a75143c0d40232383a81afc7f0 (diff) | |
parent | 817235bb60e1f79c4b22b4a6116a1594aa75b81d (diff) | |
download | hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.zip hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.tar.gz hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '817235bb60e1f79c4b22b4a6116a1594aa75b81d': (145 commits)
Remove const
Fix compile error - declaration after executable statement
Adjust cache.c only variables.
Fix include to correct memory calls - big-endian issue.
Update h5debug to retrieve file pointer through VOL framework
Minor whitespace
Remove duplicate instance
Revert and move declaration
Correct struct access
Fix duplicate and varname
Fix compile and test issues from DT
Modify H5VL initialization routines to initialize all VOL-managed object types. Modify H5VLwrap_register() to reject non-VOL-managed object types. Also fix overisights in h5trace.c from previous changes.
Add release note for sanitizer support
HDFFV-10979 cleanup globals
TRILABS-135 Add clang analyzers
HDFFV-10979 fix global name clash
Fix issues found with ONLY_SHARED_LIBS option
Fix 2010 compile issues
Change from using H5Dcreate to H5Dcreate2
Latest date first in RELEASE.txt
...
Diffstat (limited to 'hl/tools/gif2h5/gifread.c')
-rw-r--r-- | hl/tools/gif2h5/gifread.c | 92 |
1 files changed, 46 insertions, 46 deletions
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 */ |