summaryrefslogtreecommitdiffstats
path: root/hl/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-03-27 21:40:24 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-03-27 21:40:24 (GMT)
commitb9173f64d7b8ecc84dfc4728649adcfee24eb633 (patch)
treec7e44e27e5da78b8474bd99ef2200be02fb0684d /hl/tools
parent9283f262f6bedc711a9149d711b34aaf352fc252 (diff)
downloadhdf5-b9173f64d7b8ecc84dfc4728649adcfee24eb633.zip
hdf5-b9173f64d7b8ecc84dfc4728649adcfee24eb633.tar.gz
hdf5-b9173f64d7b8ecc84dfc4728649adcfee24eb633.tar.bz2
[svn-r13556]
Code cleaning regarding formatting and indentation Tested linux
Diffstat (limited to 'hl/tools')
-rw-r--r--hl/tools/gif2h5/gifread.c150
-rw-r--r--hl/tools/gif2h5/hdf2gif.c10
-rw-r--r--hl/tools/gif2h5/hdfgifwr.c20
-rw-r--r--hl/tools/gif2h5/readhdf.c70
-rw-r--r--hl/tools/gif2h5/writehdf.c2
5 files changed, 126 insertions, 126 deletions
diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c
index 14dd6b8..a08564a 100644
--- a/hl/tools/gif2h5/gifread.c
+++ b/hl/tools/gif2h5/gifread.c
@@ -129,52 +129,52 @@ ReadGifImageDesc(
{
WORD i; /* Loop counter */
WORD tableSize; /* Number of entries in the Local Color Table */
- /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
- BYTE *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.
- */
+ /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */
+ BYTE *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 = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
+ if (EndianOrder == 1) /* LittleEndian */
+ {
+ GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
- GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
- GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
+ GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
- }
- else
- {
- GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
- GifImageDesc->ImageWidth = ((WORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+ }
+ else
+ {
+ GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
+ GifImageDesc->ImageWidth = ((WORD) (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 = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
+ GifImageDesc->ImageHeight = ((WORD) (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)
{
/* Read number of color table entries */
tableSize = (WORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
- GifImageDesc->TableSize = tableSize;
+ GifImageDesc->TableSize = tableSize;
/* Read the Local Color Table */
for (i = 0; i < tableSize; i++)
{
@@ -184,25 +184,25 @@ ReadGifImageDesc(
}
}
- /*
- ** Get LZW minimum Code Size
- */
- GifImageDesc->CodeSize = (WORD)*(*MemGif2)++;
+ /*
+ ** Get LZW minimum Code Size
+ */
+ GifImageDesc->CodeSize = (WORD)*(*MemGif2)++;
- /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
- if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
- printf("Out of memory");
- exit(-1);
- }
+ /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
+ if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
+ printf("Out of memory");
+ exit(-1);
+ }
- TempPtr = GifImageDesc->GIFImage;
- do
- {
- ch = ch1 = (int)*(*MemGif2)++;
- while (ch--) *TempPtr++ = *(*MemGif2)++;
- }
- while (ch1);
+ TempPtr = GifImageDesc->GIFImage;
+ do
+ {
+ ch = ch1 = (int)*(*MemGif2)++;
+ while (ch--) *TempPtr++ = *(*MemGif2)++;
+ }
+ while (ch1);
return(0); /* No FILE stream error occured */
@@ -251,23 +251,23 @@ ReadGifPlainText(
{
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);
/*
- GifPlainText->Terminator = 0;
- */
+ GifPlainText->Terminator = 0;
+ */
/* Check for a FILE stream error */
- /*
+ /*
if (ferror(FpGif))
return(-1);
- */
+ */
return(0); /* No FILE stream error occured */
}
@@ -290,22 +290,22 @@ ReadGifApplication(
{
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;
- */
+ */
- /* Check for a FILE stream error */
- /*
+ /* Check for a FILE stream error */
+ /*
if (ferror(FpGif))
return(-1);
- */
+ */
return(0); /* No FILE stream error occured */
}
@@ -355,27 +355,27 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream
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 */
- int tempcount = 0;
+ 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 = (BYTE *) 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");
+ printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed");
return((BYTE *) NULL);
- }
+ }
for (;;)
{
- tempcount++;
+ tempcount++;
bufSize += (dataSize); /* Running total of the buffer size */
- *DSize = bufSize;
+ *DSize = bufSize;
#ifdef COMMENTED_OUT
- *ptr1++ = dataSize; /* Write the data count */
+ *ptr1++ = dataSize; /* Write the data count */
#endif /* COMMENTED_OUT */
- while (dataSize--) /* Read/write the Plain Text data */
+ while (dataSize--) /* Read/write the Plain Text data */
*ptr1++ = *(*MemGif2)++;
/* Check if there is another data sub-block */
@@ -387,14 +387,14 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream
return((BYTE *) NULL);
- ptr1 += bufSize; /* Move pointer to the end of the data */
+ ptr1 += bufSize; /* Move pointer to the end of the data */
}
- *ptr1++ = '\0';
+ *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/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c
index 49e65a2..9a15c91 100644
--- a/hl/tools/gif2h5/hdf2gif.c
+++ b/hl/tools/gif2h5/hdf2gif.c
@@ -89,13 +89,13 @@ int main(int argc , char **argv)
int LeftOfs, TopOfs;
int CountDown;
int curx , cury;
- int w,h;
+ int w,h;
#endif /* UNUSED */
int ColorMapSize, InitCodeSize, Background, BitsPerPixel;
int j,nc;
- int i;
+ int i;
int numcols = 256;
- int time_out = 0; /* time between two images in the animation */
+ int time_out = 0; /* time between two images in the animation */
int n_images , idx;
BYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
@@ -216,8 +216,8 @@ int main(int argc , char **argv)
return -1;
}
- assert(dim_sizes[0]==(hsize_t)((int)dim_sizes[0]));
- assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1]));
+ assert(dim_sizes[0]==(hsize_t)((int)dim_sizes[0]));
+ assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1]));
RWidth = (int)dim_sizes[1];
RHeight = (int)dim_sizes[0];
#ifdef UNUSED
diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c
index 6505e92..66cf0d1 100644
--- a/hl/tools/gif2h5/hdfgifwr.c
+++ b/hl/tools/gif2h5/hdfgifwr.c
@@ -38,12 +38,12 @@
*
* Based on: compress.c - File compression ala IEEE Computer, June 1984.
*
- * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
- * Jim McKie (decvax!mcvax!jim)
- * Steve Davies (decvax!vax135!petsd!peora!srd)
- * Ken Turkowski (decvax!decwrl!turtlevax!ken)
- * James A. Woods (decvax!ihnp4!ames!jaw)
- * Joe Orost (decvax!vax135!petsd!joe)
+ * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
+ * Jim McKie (decvax!mcvax!jim)
+ * Steve Davies (decvax!vax135!petsd!peora!srd)
+ * Ken Turkowski (decvax!decwrl!turtlevax!ken)
+ * James A. Woods (decvax!ihnp4!ames!jaw)
+ * Joe Orost (decvax!vax135!petsd!joe)
*****************************************************************/
@@ -53,8 +53,8 @@
#include "gif.h"
-typedef BYTE byte;
-typedef long int count_int;
+typedef BYTE byte;
+typedef long int count_int;
/* indicies into conv24MB */
#define CONV24_8BIT 0
@@ -175,8 +175,8 @@ static int cur_bits = 0;
#ifndef WIN32
#define min(a,b) ((a>b) ? b : a)
#endif
-#define XV_BITS 12 /* BITS was already defined on some systems */
-#define MSDOS 1
+#define XV_BITS 12 /* BITS was already defined on some systems */
+#define MSDOS 1
#define HSIZE 5003 /* 80% occupancy */
typedef unsigned char char_type;
diff --git a/hl/tools/gif2h5/readhdf.c b/hl/tools/gif2h5/readhdf.c
index 22b406b..a66bf85 100644
--- a/hl/tools/gif2h5/readhdf.c
+++ b/hl/tools/gif2h5/readhdf.c
@@ -53,13 +53,13 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
hid_t fHfile; /* H5 file to open */
hid_t dspace; /* dataspace identifier for the the dataset */
hid_t dtype; /* datatype identifier for the the dataset */
- hid_t mtype_id; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- hid_t dset; /* dataset identifier */
+ hid_t mtype_id; /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ hid_t dset; /* dataset identifier */
hid_t pal_set; /* dataset for palette */
hid_t pal_space; /* dataspace for palette */
hid_t pal_dtype; /* datatype for palette */
- hsize_t datasize; /* size of the image */
+ hsize_t datasize; /* size of the image */
int pal_exist=0; /* do we have a palette? */
/* check stuff */
@@ -112,17 +112,17 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
return -1;
}
- /* get memory type */
- if ((mtype_id=h5tools_get_native_type(dtype))<0){
- fprintf(stderr , "Unable to get memory type\n");
- return -1;
- }
-
- /* get memory datatype size */
- if ((msize=H5Tget_size(mtype_id))==0){
- fprintf(stderr , "Unable to get memory size\n");
- return -1;
- }
+ /* get memory type */
+ if ((mtype_id=h5tools_get_native_type(dtype))<0){
+ fprintf(stderr , "Unable to get memory type\n");
+ return -1;
+ }
+
+ /* get memory datatype size */
+ if ((msize=H5Tget_size(mtype_id))==0){
+ fprintf(stderr , "Unable to get memory size\n");
+ return -1;
+ }
/* size needed to store the image */
datasize = image_size[0] * image_size[1];
@@ -143,7 +143,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
if (pal_exist) {
hsize_t loc_pal_size[2];
hsize_t pal_datasize;
- hid_t pal_mtype_id;
+ hid_t pal_mtype_id;
void *temp_buf;
/* get the palette dataset */
@@ -181,27 +181,27 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
return -1;
}
- /* get memory type */
- if ((pal_mtype_id=h5tools_get_native_type(pal_dtype))<0){
+ /* get memory type */
+ if ((pal_mtype_id=h5tools_get_native_type(pal_dtype))<0){
fprintf(stderr , "Unable to get memory type\n");
return -1;
}
-
- /* get memory datatype size */
- if ((msize=H5Tget_size(pal_mtype_id))==0){
+
+ /* get memory datatype size */
+ if ((msize=H5Tget_size(pal_mtype_id))==0){
fprintf(stderr , "Unable to get memory size\n");
return -1;
}
-
+
/* size needed to store the image */
pal_datasize = loc_pal_size[0] * loc_pal_size[1];
/* copy stuff into a temp buffer and then copy 256*3 elements to palette */
- temp_buf=(void *) malloc((unsigned)(pal_datasize*msize));
- if ( temp_buf==NULL){
- printf( "cannot read into memory\n" );
- return -1;
- }
+ temp_buf=(void *) malloc((unsigned)(pal_datasize*msize));
+ if ( temp_buf==NULL){
+ printf( "cannot read into memory\n" );
+ return -1;
+ }
/*
* make sure that the palette is actually 256 X 3 so that we don't
* create overflows
@@ -225,12 +225,12 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
/* get rid of the temp memory */
cleanup(temp_buf);
-
- /* close pal ids */
- H5Dclose(pal_set);
- H5Sclose(pal_space);
- H5Tclose(pal_dtype);
- H5Tclose(pal_mtype_id);
+
+ /* close pal ids */
+ H5Dclose(pal_set);
+ H5Sclose(pal_space);
+ H5Tclose(pal_dtype);
+ H5Tclose(pal_mtype_id);
/* end of if (pal_exist) */
} else {
int i;
@@ -248,8 +248,8 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size,
/* close everything */
H5Dclose(dset);
H5Sclose(dspace);
- H5Tclose(dtype);
- H5Tclose(mtype_id);
+ H5Tclose(dtype);
+ H5Tclose(mtype_id);
H5Fclose(fHfile);
return 0;
}
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index 5115797..c0c4742 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -65,7 +65,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
/* 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;