Dead code removal

This commit is contained in:
Shahram Najm 2023-06-25 15:17:53 +01:00
parent 91949de28d
commit 91eee4e164
5 changed files with 32 additions and 36 deletions

View File

@ -10,7 +10,6 @@
/*************************************************************************** /***************************************************************************
* Enrico Fucile - 19.06.2007 * * Enrico Fucile - 19.06.2007 *
* *
***************************************************************************/ ***************************************************************************/
#ifdef ECCODES_ON_WINDOWS #ifdef ECCODES_ON_WINDOWS
@ -223,15 +222,16 @@ unsigned long grib_decode_unsigned_long(const unsigned char* p, long* bitp, long
return grib_decode_unsigned_long(p, bitp, bits); return grib_decode_unsigned_long(p, bitp, bits);
} }
#if 0
long ret2 = 0; // Old algorithm:
for(i=0; i< nbits;i++){ // long ret2 = 0;
ret2 <<= 1; // for(i=0; i< nbits;i++){
if(grib_get_bit( p, *bitp)) ret2 += 1; // ret2 <<= 1;
*bitp += 1; // if(grib_get_bit( p, *bitp)) ret2 += 1;
} // *bitp += 1;
*bitp -= nbits; // }
#else // *bitp -= nbits;
mask = BIT_MASK(nbits); mask = BIT_MASK(nbits);
/* pi: position of bitp in p[]. >>3 == /8 */ /* pi: position of bitp in p[]. >>3 == /8 */
pi = oc; pi = oc;
@ -256,7 +256,7 @@ unsigned long grib_decode_unsigned_long(const unsigned char* p, long* bitp, long
/* remove leading bits (from previous value) */ /* remove leading bits (from previous value) */
ret &= mask; ret &= mask;
/* printf("%d %d\n", ret2, ret);*/ /* printf("%d %d\n", ret2, ret);*/
#endif
return ret; return ret;
} }

View File

@ -10,7 +10,6 @@
/*************************************************************************** /***************************************************************************
* Enrico Fucile - 19.06.2007 * * Enrico Fucile - 19.06.2007 *
* *
***************************************************************************/ ***************************************************************************/
/** /**
* decode an array of n_vals values from a octet-stream * decode an array of n_vals values from a octet-stream
@ -81,20 +80,19 @@ int grib_decode_double_array(const unsigned char* p, long* bitp, long bitsPerVal
unsigned long lvalue = 0; unsigned long lvalue = 0;
double x; double x;
#if 0 // Slow reference code
/* slow reference code */ // int j=0;
int j=0; // for(i=0;i < n_vals;i++) {
for(i=0;i < n_vals;i++) { // lvalue=0;
lvalue=0; // for(j=0; j< bitsPerValue;j++){
for(j=0; j< bitsPerValue;j++){ // lvalue <<= 1;
lvalue <<= 1; // if(grib_get_bit( p, *bitp)) lvalue += 1;
if(grib_get_bit( p, *bitp)) lvalue += 1; // *bitp += 1;
*bitp += 1; // }
} // x=((lvalue*s)+reference_value)*d;
x=((lvalue*s)+reference_value)*d; // val[i] = (double)x;
val[i] = (double)x; // }
}
#endif
unsigned long mask = BIT_MASK(bitsPerValue); unsigned long mask = BIT_MASK(bitsPerValue);
/* pi: position of bitp in p[]. >>3 == /8 */ /* pi: position of bitp in p[]. >>3 == /8 */

View File

@ -172,7 +172,7 @@ int grib_lookup_long_from_array(grib_context* gc, grib_loader* loader, const cha
// grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set %s to double, wrong type (%d)", // grib_context_log(h->context, GRIB_LOG_ERROR, "Unable to set %s to double, wrong type (%d)",
// ga->name, type); // ga->name, type);
// } // }
// #if 0 // #if defined(OLD_IMPL)
// switch(grib_accessor_get_native_type(ga)) // switch(grib_accessor_get_native_type(ga))
// { // {
// case GRIB_TYPE_STRING: // case GRIB_TYPE_STRING:

View File

@ -96,14 +96,12 @@ int grib_init_accessor_from_handle(grib_loader* loader, grib_accessor* ga, grib_
return GRIB_SUCCESS; return GRIB_SUCCESS;
} }
#if 0 // if(h->values)
if(h->values) // if(copy_values(h,ga) == GRIB_SUCCESS)
if(copy_values(h,ga) == GRIB_SUCCESS) // {
{ // grib_context_log(h->context,GRIB_LOG_DEBUG, "Copying: setting %s to multi-set-value", ga->name);
grib_context_log(h->context,GRIB_LOG_DEBUG, "Copying: setting %s to multi-set-value", ga->name); // return GRIB_SUCCESS;
return GRIB_SUCCESS; // }
}
#endif
#if 0 #if 0
if(h->loader) if(h->loader)

View File

@ -275,7 +275,7 @@ void grib_md5_end(grib_md5_state* s, char* digest)
U(s->h3 & 0xff), U((s->h3 >> 8) & 0xff), U((s->h3 >> 16) & 0xff), U((s->h3 >> 24) & 0xff)); U(s->h3 & 0xff), U((s->h3 >> 8) & 0xff), U((s->h3 >> 16) & 0xff), U((s->h3 >> 24) & 0xff));
} }
#if 0 #if defined(TESTING_MD5)
main(int argc, char **argv) main(int argc, char **argv)
{ {