diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c index 4f3de208b7..f16bb5b7fe 100644 --- a/hdf/src/hcomp.c +++ b/hdf/src/hcomp.c @@ -808,102 +808,6 @@ HCcreate(int32 file_id, uint16 tag, uint16 ref, comp_model_t model_type, model_i return ret_value; } /* end HCcreate() */ -/*-------------------------------------------------------------------------- - NAME - HCPgetcompress -- Retrieves compression information of an element - USAGE - intn HCPgetcompress(aid, coder_type, c_info) - int32 aid; IN: access record ID - comp_coder_t* coder_type; OUT: the type of compression - comp_info* c_info; OUT: ptr to compression information - structure for storing the retrieved info - RETURNS - SUCCEED/FAIL - DESCRIPTION - This routine retrieves the compression type and the compression - information of the element, identified by 'aid'. The routine is - used by GRgetcompinfo and SDgetcompinfo at this time. - - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG - July 2001: Added to fix bug #307 - BMR - Dec. 2004: Changed name to HCPgetcompress, to be consistent with other - practice. REM ---------------------------------------------------------------------------*/ -intn -HCPgetcompress(int32 file_id, uint16 data_tag, uint16 data_ref, - comp_coder_t *comp_type, /* OUT: compression type */ - comp_info *c_info) /* OUT: retrieved compression info */ -{ - int32 aid = 0, status; - accrec_t *access_rec = NULL; /* access element record */ - compinfo_t *info = NULL; /* compressed element information */ - model_info m_info; /* modeling information - dummy */ - int32 ret_value = SUCCEED; - - /* clear error stack */ - HEclear(); - - /* start read access on the access record of the data element, which - is being inquired for its compression information */ - aid = Hstartread(file_id, data_tag, data_ref); - - /* get the access_rec pointer */ - access_rec = HAatom_object(aid); - if (access_rec == NULL) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* if the element is compressed, get the compression info as requested*/ - if (access_rec->special == SPECIAL_COMP) { - info = (compinfo_t *)access_rec->special_info; - if (info == NULL) - HGOTO_ERROR(DFE_COMPINFO, FAIL); - - status = HCIread_header(access_rec, info, c_info, &m_info); - if (status == FAIL) - HGOTO_ERROR(DFE_COMPINFO, FAIL); - - /* get the compression type */ - *comp_type = info->cinfo.coder_type; - - } /* end if element is compressed */ - - /* if the element is chunked, call HMCgetcompress to get the - compression info as appropriate */ - else if (access_rec->special == SPECIAL_CHUNKED) { - status = HMCgetcompress(access_rec, comp_type, c_info); - if (status == FAIL) - HGOTO_ERROR(DFE_COMPINFO, FAIL); - } - - /* flag the error when attempting to get compression info on a - non-compressed element */ - else - /* EIP 9/16/03 Fail but return compression type COMP_CODE_NONE - instead of junk in this case. - */ - { - /*Mac OSX screams here (comp_coder_t)*comp_type = COMP_CODE_NONE; */ - *comp_type = COMP_CODE_NONE; - HGOTO_ERROR(DFE_ARGS, FAIL); - } - /* end access to the aid appropriately */ - if (Hendaccess(aid) == FAIL) - HGOTO_ERROR(DFE_CANTENDACCESS, FAIL); - -done: - if (ret_value == FAIL) { /* Error condition cleanup */ - /* end access to the aid if it's been accessed */ - if (aid != 0) - if (Hendaccess(aid) == FAIL) - HERROR(DFE_CANTENDACCESS); - } - - return ret_value; -} /* HCPgetcompress */ - /*-------------------------------------------------------------------------- NAME HCPgetcompinfo -- Retrieves compression information of an element @@ -920,17 +824,6 @@ HCPgetcompress(int32 file_id, uint16 data_tag, uint16 data_ref, information of the element, identified by 'aid'. The routine is used by GRgetcompinfo and SDgetcompinfo at this time. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG - July 2001: Added to fix bug #307 - BMR - Dec. 2004: Changed name to HCPgetcompress, to be consistent with other - practice. REM - Apr. 2005: HCPgetcompinfo was added to fix bugzilla #130 and may replace - HCPgetcompress in the future because HCPgetcompress did not - behave correctly. The revision logs above are carried over - from HCPgetcompress for the records. --------------------------------------------------------------------------*/ intn HCPgetcompinfo(int32 file_id, uint16 data_tag, uint16 data_ref, diff --git a/hdf/src/hproto.h b/hdf/src/hproto.h index b52ba098e3..c8dc9857c5 100644 --- a/hdf/src/hproto.h +++ b/hdf/src/hproto.h @@ -365,9 +365,6 @@ HDFLIBAPI intn HXsetdir(const char *dir); HDFLIBAPI int32 HCcreate(int32 file_id, uint16 tag, uint16 ref, comp_model_t model_type, model_info *m_info, comp_coder_t coder_type, comp_info *c_info); -HDFLIBAPI intn HCPgetcompress(int32 file_id, uint16 data_tag, uint16 data_ref, comp_coder_t *coder_type, - comp_info *c_info); - HDFLIBAPI intn HCPgetcompinfo(int32 file_id, uint16 data_tag, uint16 data_ref, comp_coder_t *coder_type, comp_info *c_info); diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index 6b1c87573f..f0b12a421f 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -4083,7 +4083,7 @@ GRsetcompress(int32 riid, comp_coder_t comp_type, comp_info *cinfo) /*-------------------------------------------------------------------------- NAME - GRgetcompress + GRgetcompress - Deprecated in favor of GRgetcompinfo PURPOSE Get the compression information of a raster image's data. @@ -4109,53 +4109,15 @@ GRsetcompress(int32 riid, comp_coder_t comp_type, comp_info *cinfo) mapped to a quantization table. Thus, only the correct compression type will be returned; cinfo will only contain 0s. - EXAMPLES - REVISION LOG - July 2001: Added to fix bug #307 -BMR - Apr 2005: Replaced by GRgetcompinfo due to deficiency in handling some - special elements. -BMR --------------------------------------------------------------------------*/ intn GRgetcompress(int32 riid, comp_coder_t *comp_type, comp_info *cinfo) { - ri_info_t *ri_ptr; /* ptr to the image to work with */ - int32 file_id; - uint16 scheme; /* compression scheme used for JPEG images */ - intn ret_value = SUCCEED; - - /* clear error stack and check validity of args */ - HEclear(); - - /* check the validity of the RI ID */ - if (HAatom_group(riid) != RIIDGROUP) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* and check the output arguments */ - if (comp_type == NULL || cinfo == NULL) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* locate RI's object in hash table */ - if (NULL == (ri_ptr = (ri_info_t *)HAatom_object(riid))) - HGOTO_ERROR(DFE_BADPTR, FAIL); - - file_id = ri_ptr->gr_ptr->hdf_file_id; /* temporary use */ + intn ret_value = SUCCEED; - /* If the compression scheme used was JPEG, return the compression type - and 0 for the 'quality' and 'force_baseline' parameters, because - these parameters are currently not possible to be retrieved. */ - scheme = ri_ptr->img_dim.comp_tag; - if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5 || scheme == DFTAG_JPEG || - scheme == DFTAG_GREYJPEG) { - *comp_type = COMP_CODE_JPEG; - cinfo->jpeg.quality = 0; - cinfo->jpeg.force_baseline = 0; - } - else { - /* use lower-level routine to get the compression information */ - ret_value = HCPgetcompress(file_id, ri_ptr->img_tag, ri_ptr->img_ref, comp_type, cinfo); - if (ret_value == FAIL) - HGOTO_ERROR(DFE_INTERNAL, FAIL); - } + ret_value = GRgetcompinfo(riid, comp_type, cinfo); + if (ret_value == FAIL) + HGOTO_ERROR(DFE_INTERNAL, FAIL); done: return ret_value; @@ -4293,15 +4255,6 @@ GRgetcomptype(int32 riid, comp_coder_t *comp_type) mapped to a quantization table. Thus, only the correct compression type will be returned; cinfo will only contain 0s. - EXAMPLES - REVISION LOG - July 2001: Added to fix bug #307 - BMR (from GRgetcompress) - Apr 2005: This function was actually created at this time, but it is - almost a duplicate of GRgetcompress, which is intended to be - removed in the future, due to its incorrect behavior. The - only difference is the call to the low-level routine, - HCPgetcompinfo, instead of HCPgetcompress. - --------------------------------------------------------------------------*/ intn GRgetcompinfo(int32 riid, comp_coder_t *comp_type, comp_info *cinfo) diff --git a/mfhdf/fortran/mfsdf.c b/mfhdf/fortran/mfsdf.c index 3abf9cfb77..9cb4f92445 100644 --- a/mfhdf/fortran/mfsdf.c +++ b/mfhdf/fortran/mfsdf.c @@ -1572,7 +1572,7 @@ nsfsflmd(intf *id, intf *fillmode) /*------------------------------------------------------------------------- * Name: scgichnk - * Puporse: Call SDgetchunkinfo + * Purpose: Call SDgetchunkinfo * Inputs: id: SDS access id * Outputs: dim_length: chunk dimensions * flags: -1 - SDS is nonchunked @@ -1747,7 +1747,7 @@ nscscchnk(intf *id, intf *maxcache, intf *flags) /*------------------------------------------------------------------------- * Name: scschnk - * Puporse: Call SDsetchunk + * Purpose: Call SDsetchunk * Inputs: id: SDS access id * dim_length: chunk dimensions * comp_type: type of compression @@ -1932,7 +1932,7 @@ nscwcchnk(intf *id, intf *start, _fcd char_data) /*------------------------------------------------------------------------- * Name: scscompress - * Puporse: Call SDsetcompress + * Purpose: Call SDsetcompress * Inputs: id: SDS access id * comp_type: type of compression * COMP_CODE_NONE = 0 @@ -1998,7 +1998,7 @@ nscscompress(intf *id, intf *comp_type, intf *comp_prm) /*------------------------------------------------------------------------- * Name: scgcompress - * Puporse: Call SDgetcompress + * Purpose: Call SDgetcompinfo * Inputs: id: SDS access id * Outputs: comp_type: type of compression * COMP_CODE_NONE = 0 diff --git a/mfhdf/fortran/tszip.f b/mfhdf/fortran/tszip.f index 28e75284da..231d535527 100644 --- a/mfhdf/fortran/tszip.f +++ b/mfhdf/fortran/tszip.f @@ -277,17 +277,12 @@ program test_szip . compressed dataset' err_szip = err_szip + 1 endif -C write(*,*) comp_arg(1), comp_prm_out(1) -C write(*,*) comp_arg(2), comp_prm_out(2) -C write(*,*) comp_prm_out(3) -C write(*,*) comp_prm_out(4) -C write(*,*) comp_prm_out(5) -C if ((comp_arg(1) .ne. comp_prm_out(1)) .or. -C . (comp_arg(2) .ne. comp_prm_out(2))) then -C print *, 'wrong compression parameter' -C err_szip = err_szip + 1 -C endif + if ((comp_arg(1) .ne. comp_prm_out(1)) .or. + . (comp_arg(2) .ne. comp_prm_out(2))) then + print *, 'wrong compression parameter' + err_szip = err_szip + 1 + endif C C Read part of the data back using sfrdata function diff --git a/mfhdf/libsrc/mfsd.c b/mfhdf/libsrc/mfsd.c index 60f783e95d..c6894566b0 100644 --- a/mfhdf/libsrc/mfsd.c +++ b/mfhdf/libsrc/mfsd.c @@ -3321,7 +3321,8 @@ SDgetexternalinfo(int32 id, /* IN: dataset ID */ /************************** Deprecated ****************************** NAME SDgetexternalfile -- retrieves external file information - (Deprecated) + (Deprecated in favor of SDgetexternalinfo) + USAGE int32 SDgetexternalfile(id, filename, offset) int32 id; @@ -3741,9 +3742,10 @@ SDsetcompress(int32 id, /* IN: dataset ID */ #ifndef H4_NO_DEPRECATED_SYMBOLS -/****************************************************************************** +/****************************** Deprecated *********************************** NAME SDgetcompress -- Retrieves compression information of a dataset + (Deprecated in favor of SDgetcompinfo) DESCRIPTION This routine uses HCPgetcompress to retrieve the compression type @@ -3752,11 +3754,6 @@ SDsetcompress(int32 id, /* IN: dataset ID */ RETURNS SUCCEED/FAIL - MODIFICATION - July 2001: Added to fix bug #307 - BMR - Apr 2005: This function has incorrect behavior and is replaced by - SDgetcompinfo. SDgetcompress will be removed in the future. - ******************************************************************************/ intn SDgetcompress( @@ -3773,24 +3770,7 @@ SDgetcompress( /* clear error stack */ HEclear(); - if (comp_type == NULL || c_info == NULL) - HGOTO_ERROR(DFE_ARGS, FAIL); - - handle = SDIhandle_from_id(id, SDSTYPE); - if (handle == NULL || handle->file_type != HDF_FILE) - HGOTO_ERROR(DFE_ARGS, FAIL); - if (handle->vars == NULL) - HGOTO_ERROR(DFE_ARGS, FAIL); - - var = SDIget_var(handle, id); - if (var == NULL) - HGOTO_ERROR(DFE_ARGS, FAIL); - - if (!var->data_ref) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* use lower-level routine to get the compression information */ - status = HCPgetcompress(handle->hdf_file, var->data_tag, var->data_ref, comp_type, c_info); + status = SDgetcompinfo(id, comp_type, c_info); if (status == FAIL) HGOTO_ERROR(DFE_INTERNAL, FAIL); @@ -3811,14 +3791,6 @@ SDgetcompress( RETURNS SUCCEED/FAIL - MODIFICATION - July 2001: Added to fix bug #307 - BMR (from SDgetcompress) - Apr 2005: This function was actually created at this time, but it is - almost a duplicate of SDgetcompress, which is intended to be - removed in the future, due to its incorrect behavior. The - only difference is the call to the low-level routine, - HCPgetcompinfo, instead of HCPgetcompress. - ******************************************************************************/ intn SDgetcompinfo(int32 sdsid, /* IN: dataset ID */