summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_parse.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-08-13 20:53:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-08-13 20:53:35 (GMT)
commit6b45f5172ccb4311e0be9ae15da3758abb6b0e67 (patch)
tree5a7a112fe7a8a98c6fecb45b513789d15962eb3d /tools/h5repack/h5repack_parse.c
parent6562465a2c2a58cfbc2f47bf60bb538f7a783933 (diff)
downloadhdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.zip
hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.gz
hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.bz2
[svn-r11245] Purpose:
Code cleanup Description: Trim trailing whitespace, which is making 'diff'ing the two branches difficult. Solution: Ran this script in each directory: foreach f (*.[ch] *.cpp) sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f end Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'tools/h5repack/h5repack_parse.c')
-rw-r--r--tools/h5repack/h5repack_parse.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 1fd61ca..7e82fde 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -36,9 +36,9 @@
* FLET, to apply the HDF5 checksum filter
* NBIT, to apply the HDF5 NBIT filter (NBIT compression)
* S+O, to apply the HDF5 scale+offset filter (compression)
- * NONE, to remove the filter
+ * NONE, to remove the filter
*
- * Examples:
+ * Examples:
* "GZIP=6"
* "A,B:NONE"
*
@@ -50,8 +50,8 @@
*/
-obj_list_t* parse_filter(const char *str,
- int *n_objs,
+obj_list_t* parse_filter(const char *str,
+ int *n_objs,
filter_info_t *filt,
pack_opt_t *options)
{
@@ -59,10 +59,10 @@ obj_list_t* parse_filter(const char *str,
char c;
size_t len=strlen(str);
int j, m, n, k, l, end_obj=-1, no_param=0;
- char sobj[MAX_NC_NAME];
+ char sobj[MAX_NC_NAME];
char scomp[10];
char stype[5];
- char smask[3];
+ char smask[3];
obj_list_t* obj_list=NULL;
unsigned pixels_per_block;
@@ -91,7 +91,7 @@ obj_list_t* parse_filter(const char *str,
/* apply to all objects */
options->all_filter=1;
}
-
+
n++;
obj_list=malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
@@ -106,7 +106,7 @@ obj_list_t* parse_filter(const char *str,
{
c = str[j];
sobj[k]=c;
- if ( c==',' || j==end_obj-1)
+ if ( c==',' || j==end_obj-1)
{
if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
strcpy(obj_list[n].obj,sobj);
@@ -130,7 +130,7 @@ obj_list_t* parse_filter(const char *str,
{
c = str[i];
scomp[k]=c;
- if ( c=='=' || i==len-1)
+ if ( c=='=' || i==len-1)
{
if ( c=='=') { /*one more parameter */
scomp[k]='\0'; /*cut space */
@@ -139,11 +139,11 @@ obj_list_t* parse_filter(const char *str,
SZIP=8,EC
SZIP=8,NN
*/
-
+
if (strcmp(scomp,"SZIP")==0)
{
l=-1; /* mask index check */
- for ( m=0,u=i+1; u<len; u++,m++)
+ for ( m=0,u=i+1; u<len; u++,m++)
{
if (str[u]==',')
{
@@ -159,7 +159,7 @@ obj_list_t* parse_filter(const char *str,
}
if (l==-1)
stype[m]=c;
- else
+ else
{
smask[l]=c;
l++;
@@ -168,7 +168,7 @@ obj_list_t* parse_filter(const char *str,
smask[l]='\0';
i=len-1; /* end */
(*n_objs)--; /* we counted an extra ',' */
- if (strcmp(smask,"NN")==0)
+ if (strcmp(smask,"NN")==0)
filt->szip_coding=0;
else if (strcmp(smask,"EC")==0)
filt->szip_coding=1;
@@ -177,17 +177,17 @@ obj_list_t* parse_filter(const char *str,
printf("Input Error: szip mask must be 'NN' or 'EC' \n");
exit(1);
}
-
+
}
}
-
+
} /* u */
} /*if */
-
+
else
{
/* here we could have 1 or 2 digits */
- for ( m=0,u=i+1; u<len; u++,m++)
+ for ( m=0,u=i+1; u<len; u++,m++)
{
c = str[u];
if (!isdigit(c)){
@@ -202,7 +202,7 @@ obj_list_t* parse_filter(const char *str,
} /*if */
-
+
filt->cd_values[j++]=atoi(stype);
i+=m; /* jump */
}
@@ -313,7 +313,7 @@ obj_list_t* parse_filter(const char *str,
switch (filt->filtn)
{
-
+
case H5Z_FILTER_DEFLATE:
if (filt->cd_values[0]<0 || filt->cd_values[0]>9 ){
if (obj_list) free(obj_list);
@@ -321,8 +321,8 @@ obj_list_t* parse_filter(const char *str,
exit(1);
}
break;
-
-
+
+
case H5Z_FILTER_SZIP:
pixels_per_block=filt->cd_values[0];
if ((pixels_per_block%2)==1) {
@@ -385,7 +385,7 @@ const char* get_sfilter(H5Z_filter_t filtn)
exit(1);
}
return NULL;
-}
+}
/*-------------------------------------------------------------------------
@@ -393,14 +393,14 @@ const char* get_sfilter(H5Z_filter_t filtn)
*
* Purpose: read layout info
*
- * Return: a list of names, the number of names and its chunking info for
+ * Return: a list of names, the number of names and its chunking info for
* chunked. NULL, on error
* the layout type can be:
* CHUNK, to apply chunking layout
* CONTI, to apply continuous layout
* COMPA, to apply compact layout
*
- * Example:
+ * Example:
* "AA,B,CDE:CHUNK=10X10"
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
@@ -409,8 +409,8 @@ const char* get_sfilter(H5Z_filter_t filtn)
*
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_layout(const char *str,
- int *n_objs,
+obj_list_t* parse_layout(const char *str,
+ int *n_objs,
pack_info_t *pack, /* info about layout needed */
pack_opt_t *options)
{
@@ -419,7 +419,7 @@ obj_list_t* parse_layout(const char *str,
char c;
size_t len=strlen(str);
int j, n, k, end_obj=-1, c_index;
- char sobj[MAX_NC_NAME];
+ char sobj[MAX_NC_NAME];
char sdim[10];
char slayout[10];
@@ -427,7 +427,7 @@ obj_list_t* parse_layout(const char *str,
memset(sdim, '\0', sizeof(sdim));
memset(sobj, '\0', sizeof(sobj));
memset(slayout, '\0', sizeof(slayout));
-
+
/* check for the end of object list and number of objects */
for ( i=0, n=0; i<len; i++)
{
@@ -445,7 +445,7 @@ obj_list_t* parse_layout(const char *str,
if (end_obj==-1) { /* missing : chunk all */
options->all_layout=1;
}
-
+
n++;
obj_list=malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
@@ -460,7 +460,7 @@ obj_list_t* parse_layout(const char *str,
{
c = str[j];
sobj[k]=c;
- if ( c==',' || j==end_obj-1)
+ if ( c==',' || j==end_obj-1)
{
if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0';
strcpy(obj_list[n].obj,sobj);
@@ -481,11 +481,11 @@ obj_list_t* parse_layout(const char *str,
/* get layout info */
for ( j=end_obj+1, n=0; n<=5; j++,n++)
{
- if (n==5)
+ if (n==5)
{
slayout[n]='\0'; /*cut string */
if (strcmp(slayout,"COMPA")==0)
- pack->layout=H5D_COMPACT;
+ pack->layout=H5D_COMPACT;
else if (strcmp(slayout,"CONTI")==0)
pack->layout=H5D_CONTIGUOUS;
else if (strcmp(slayout,"CHUNK")==0)
@@ -501,7 +501,7 @@ obj_list_t* parse_layout(const char *str,
slayout[n]=c;
}
} /* j */
-
+
if ( pack->layout==H5D_CHUNKED )
{
@@ -510,7 +510,7 @@ obj_list_t* parse_layout(const char *str,
* get chunk info
*-------------------------------------------------------------------------
*/
- k=0;
+ k=0;
if (j>(int)len)
{
@@ -524,8 +524,8 @@ obj_list_t* parse_layout(const char *str,
c = str[i];
sdim[k]=c;
k++; /*increment sdim index */
-
- if (!isdigit(c) && c!='x'
+
+ if (!isdigit(c) && c!='x'
&& c!='N' && c!='O' && c!='N' && c!='E'
){
if (obj_list) free(obj_list);
@@ -533,11 +533,11 @@ obj_list_t* parse_layout(const char *str,
sdim,str);
exit(1);
}
-
- if ( c=='x' || i==len-1)
+
+ if ( c=='x' || i==len-1)
{
- if ( c=='x') {
- sdim[k-1]='\0';
+ if ( c=='x') {
+ sdim[k-1]='\0';
k=0;
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0) {
@@ -549,7 +549,7 @@ obj_list_t* parse_layout(const char *str,
c_index++;
}
else if (i==len-1) { /*no more parameters */
- sdim[k]='\0';
+ sdim[k]='\0';
k=0;
if (strcmp(sdim,"NONE")==0)
{
@@ -570,10 +570,10 @@ obj_list_t* parse_layout(const char *str,
} /*if c=='x' || i==len-1 */
} /*i*/
-
+
} /*H5D_CHUNKED*/
-
+
return obj_list;
}
@@ -600,7 +600,7 @@ int parse_number(char *str)
int n;
char c;
size_t len=strlen(str);
-
+
for ( i=0; i<len; i++)
{
c = str[i];
@@ -608,7 +608,7 @@ int parse_number(char *str)
return -1;
}
}
- str[i]='\0';
+ str[i]='\0';
n=atoi(str);
return n;
}