From 91b1ab46cd4113f14b076ab0180116907e566844 Mon Sep 17 00:00:00 2001 From: Enrico Fucile Date: Thu, 29 Jan 2015 10:36:16 +0000 Subject: [PATCH] Changed signature of all X_new_from_file functions except grib_new_from_file: deleted argument headers_only which is grib specific. Fixed a problem with make proto --- examples/C/bufr_read_header.c | 3 +- fortran/grib_fortran.c | 2 +- src/extrules.am | 2 +- src/grib_api.h | 2 +- src/grib_api_prototypes.h | 168 ++++++++++++++++++++++++++++++++-- src/grib_handle.c | 60 ++++-------- src/grib_io.c | 6 +- tools/bufr_compare.c | 2 +- tools/grib_tools.c | 12 +-- 9 files changed, 196 insertions(+), 61 deletions(-) diff --git a/examples/C/bufr_read_header.c b/examples/C/bufr_read_header.c index 1f6b94509..c323e98fe 100644 --- a/examples/C/bufr_read_header.c +++ b/examples/C/bufr_read_header.c @@ -23,7 +23,6 @@ int main(int argc,char* argv[]) long longVal; int count; int err=0; - int header_only=1; if (argc!=2) usage(argv[0]); filename=argv[1]; @@ -35,7 +34,7 @@ int main(int argc,char* argv[]) } count=1; - while((h=bufr_new_from_file(NULL,f,header_only,&err)) != NULL) + while((h=bufr_new_from_file(NULL,f,&err)) != NULL) { /* Check for errors after reading a message. */ if (err != CODES_SUCCESS) CODES_CHECK(err,0); diff --git a/fortran/grib_fortran.c b/fortran/grib_fortran.c index 750545d9f..c18e8a94f 100644 --- a/fortran/grib_fortran.c +++ b/fortran/grib_fortran.c @@ -1323,7 +1323,7 @@ int bufr_f_new_from_file_(int* fid, int* gid){ grib_handle *h = NULL; if(f){ - h = bufr_new_from_file(0,f,0,&err); + h = bufr_new_from_file(0,f,&err); if(h){ push_handle(h,gid); return GRIB_SUCCESS; diff --git a/src/extrules.am b/src/extrules.am index c2e0050c2..f87383ca8 100644 --- a/src/extrules.am +++ b/src/extrules.am @@ -9,7 +9,7 @@ grib_errors.c : grib_errors.txt errors.pl cmp ../python/grib_errors.h grib_errors.h.new || (cp grib_errors.h.new ../python/grib_errors.h) -proto:;-chmod +w grib_api_prototypes.h; mkptypes -A $(libgrib_api_a_prototypes) $(libgrib_api_extra_prototypes) > temp && mv temp grib_api_prototypes.h;rm -f temp +proto:;-chmod +w grib_api_prototypes.h; mkptypes -A $(libgrib_api_la_prototypes) $(libgrib_api_extra_prototypes) > temp && mv temp grib_api_prototypes.h;rm -f temp test:all;(cd ../tests; make tests) diff --git a/src/grib_api.h b/src/grib_api.h index 6a682ef2e..7f018f3fd 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -405,7 +405,7 @@ int grib_count_in_file(grib_context* c, FILE* f,int* n); grib_handle* grib_handle_new_from_file(grib_context* c, FILE* f, int* error); /* TODO: this is temporary. Need to rationalize the X_new_from_file functions */ -grib_handle* bufr_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); +grib_handle* bufr_new_from_file(grib_context *c, FILE *f, int *error); /** diff --git a/src/grib_api_prototypes.h b/src/grib_api_prototypes.h index 6c2dc4259..acd67c3dd 100644 --- a/src/grib_api_prototypes.h +++ b/src/grib_api_prototypes.h @@ -100,6 +100,125 @@ grib_action *grib_action_create_variable(grib_context *context, const char *name /* action_class_modify.c */ grib_action *grib_action_create_modify(grib_context *context, const char *name, long flags); +/* eccodes.c */ +grib_fieldset *codes_fieldset_new_from_files(grib_context *c, char *filenames[], int nfiles, char **keys, int nkeys, char *where_string, char *order_by_string, int *err); +void codes_fieldset_delete(grib_fieldset *set); +void codes_fieldset_rewind(grib_fieldset *set); +int codes_fieldset_apply_order_by(grib_fieldset *set, const char *order_by_string); +grib_handle *codes_fieldset_next_handle(grib_fieldset *set, int *err); +int codes_fieldset_count(grib_fieldset *set); +int codes_values_check(grib_handle *h, grib_values *values, int count); +grib_index *codes_index_new_from_file(grib_context *c, char *filename, const char *keys, int *err); +grib_index *codes_index_new(grib_context *c, const char *keys, int *err); +int codes_index_add_file(grib_index *index, const char *filename); +int codes_index_write(grib_index *index, const char *filename); +grib_index *codes_index_read(grib_context *c, const char *filename, int *err); +int codes_index_get_size(grib_index *index, const char *key, size_t *size); +int codes_index_get_long(grib_index *index, const char *key, long *values, size_t *size); +int codes_index_get_double(grib_index *index, const char *key, double *values, size_t *size); +int codes_index_get_string(grib_index *index, const char *key, char **values, size_t *size); +int codes_index_select_long(grib_index *index, const char *key, long value); +int codes_index_select_double(grib_index *index, const char *key, double value); +int codes_index_select_string(grib_index *index, const char *key, char *value); +grib_handle *codes_handle_new_from_index(grib_index *index, int *err); +void codes_index_delete(grib_index *index); +int codes_count_in_file(grib_context *c, FILE *f, int *n); +grib_handle *codes_handle_new_from_file(grib_context *c, FILE *f, int *error); +int codes_write_message(grib_handle *h, const char *file, const char *mode); +grib_handle *codes_util_sections_copy(grib_handle *hfrom, grib_handle *hto, int what, int *err); +grib_string_list *codes_util_get_param_id(const char *mars_param); +grib_string_list *codes_util_get_mars_param(const char *param_id); +grib_handle *codes_handle_new_from_message(grib_context *c, void *data, size_t data_len); +grib_handle *codes_handle_new_from_message_copy(grib_context *c, const void *data, size_t data_len); +grib_handle *codes_handle_new_from_multi_message(grib_context *c, void **data, size_t *data_len, int *error); +grib_handle *codes_handle_new_from_samples(grib_context *c, const char *res_name); +grib_handle *codes_handle_clone(grib_handle *h); +int codes_handle_delete(grib_handle *h); +grib_multi_handle *codes_multi_handle_new(grib_context *c); +int codes_multi_handle_append(grib_handle *h, int start_section, grib_multi_handle *mh); +int codes_multi_handle_delete(grib_multi_handle *mh); +int codes_multi_handle_write(grib_multi_handle *mh, FILE *f); +int codes_get_message(grib_handle *h, const void **message, size_t *message_length); +int codes_get_message_copy(grib_handle *h, void *message, size_t *message_length); +grib_iterator *codes_iterator_new(grib_handle *h, unsigned long flags, int *error); +int codes_get_data(grib_handle *h, double *lats, double *lons, double *values, size_t *size); +int codes_iterator_next(grib_iterator *i, double *lat, double *lon, double *value); +int codes_iterator_previous(grib_iterator *i, double *lat, double *lon, double *value); +int codes_iterator_has_next(grib_iterator *i); +int codes_iterator_reset(grib_iterator *i); +int codes_iterator_delete(grib_iterator *i); +grib_nearest *codes_nearest_new(grib_handle *h, int *error); +int codes_nearest_find(grib_nearest *nearest, grib_handle *h, double inlat, double inlon, unsigned long flags, double *outlats, double *outlons, double *values, double *distances, int *indexes, size_t *len); +int codes_nearest_find_multiple(grib_handle *h, int is_lsm, double *inlats, double *inlons, long npoints, double *outlats, double *outlons, double *values, double *distances, int *indexes); +int codes_nearest_delete(grib_nearest *nearest); +int codes_get_size(grib_handle *h, const char *key, size_t *size); +int codes_get_length(grib_handle *h, const char *key, size_t *length); +int codes_get_long(grib_handle *h, const char *key, long *value); +int codes_get_double(grib_handle *h, const char *key, double *value); +int codes_get_double_element(grib_handle *h, const char *key, int i, double *value); +int codes_get_double_elements(grib_handle *h, const char *key, int *i, long size, double *value); +int codes_get_string(grib_handle *h, const char *key, char *mesg, size_t *length); +int codes_get_string_array(grib_handle *h, const char *name, char **val, size_t *length); +int codes_get_bytes(grib_handle *h, const char *key, unsigned char *bytes, size_t *length); +int codes_get_double_array(grib_handle *h, const char *key, double *vals, size_t *length); +int codes_get_long_array(grib_handle *h, const char *key, long *vals, size_t *length); +int codes_copy_namespace(grib_handle *dest, const char *name, grib_handle *src); +int codes_set_long(grib_handle *h, const char *key, long val); +int codes_set_double(grib_handle *h, const char *key, double val); +int codes_set_string(grib_handle *h, const char *key, const char *mesg, size_t *length); +int codes_set_bytes(grib_handle *h, const char *key, const unsigned char *bytes, size_t *length); +int codes_set_double_array(grib_handle *h, const char *key, const double *vals, size_t length); +int codes_set_force_double_array(grib_handle *h, const char *key, const double *vals, size_t length); +int codes_set_long_array(grib_handle *h, const char *key, const long *vals, size_t length); +void codes_dump_content(grib_handle *h, FILE *out, const char *mode, unsigned long option_flags, void *arg); +grib_context *codes_context_get_default(void); +grib_context *codes_context_new(grib_context *c); +void codes_context_delete(grib_context *c); +void codes_gts_header_off(grib_context *c); +void codes_gribex_mode_on(grib_context *c); +int codes_get_gribex_mode(grib_context *c); +void codes_gribex_mode_off(grib_context *c); +void codes_multi_support_on(grib_context *c); +void codes_multi_support_off(grib_context *c); +void codes_multi_support_reset_file(grib_context *c, FILE *f); +char *codes_samples_path(const grib_context *c); +long codes_get_api_version(void); +const char *codes_get_git_sha1(void); +void codes_print_api_version(FILE *out); +grib_keys_iterator *codes_keys_iterator_new(grib_handle *h, unsigned long filter_flags, char *name_space); +int codes_keys_iterator_next(grib_keys_iterator *kiter); +const char *codes_keys_iterator_get_name(grib_keys_iterator *kiter); +int codes_keys_iterator_delete(grib_keys_iterator *kiter); +int codes_keys_iterator_rewind(grib_keys_iterator *kiter); +int codes_keys_iterator_set_flags(grib_keys_iterator *kiter, unsigned long flags); +int codes_keys_iterator_get_long(grib_keys_iterator *kiter, long *v, size_t *len); +int codes_keys_iterator_get_double(grib_keys_iterator *kiter, double *v, size_t *len); +int codes_keys_iterator_get_string(grib_keys_iterator *kiter, char *v, size_t *len); +int codes_keys_iterator_get_bytes(grib_keys_iterator *kiter, unsigned char *v, size_t *len); +void codes_update_sections_lengths(grib_handle *h); +const char *codes_get_error_message(int code); +const char *codes_get_type_name(int type); +int codes_get_native_type(grib_handle *h, const char *name, int *type); +void codes_check(const char *call, const char *file, int line, int e, const char *msg); +int codes_set_values(grib_handle *h, grib_values *grib_values, size_t arg_count); +grib_handle *codes_handle_new_from_partial_message_copy(grib_context *c, const void *data, size_t size); +grib_handle *codes_handle_new_from_partial_message(grib_context *c, void *data, size_t buflen); +int codes_is_missing(grib_handle *h, const char *key, int *err); +int codes_is_defined(grib_handle *h, const char *key); +int codes_set_missing(grib_handle *h, const char *key); +int codes_get_gaussian_latitudes(long truncation, double *latitudes); +int codes_julian_to_datetime(double jd, long *year, long *month, long *day, long *hour, long *minute, long *second); +int codes_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double *jd); +long codes_julian_to_date(long jdate); +long codes_date_to_julian(long ddate); +void codes_get_reduced_row(long pl, double lon_first, double lon_last, long *npoints, long *ilon_first, long *ilon_last); +int codes_get_message_offset(grib_handle *h, off_t *offset); +int codes_get_message_size(grib_handle *h, size_t *size); +grib_box *codes_box_new(grib_handle *h, int *error); +grib_points *codes_box_get_points(grib_box *box, double north, double west, double south, double east, int *err); +int codes_points_get_values(grib_handle *h, grib_points *points, double *val); +grib_handle *codes_util_set_spec(grib_handle *h, const grib_util_grid_spec *grid_spec, const grib_util_packing_spec *packing_spec, int flags, const double *data_values, size_t data_values_count, int *err); + /* grib_accessor.c */ void grib_print_accessor(grib_accessor *a, grib_dumper *f); int grib_pack_missing(grib_accessor *a); @@ -403,6 +522,36 @@ int grib_g1_step_apply_units(long *start, long *theEnd, long *step_unit, long *P /* grib_accessor_class_ifs_param.c */ +/* grib_accessor_class_int16.c */ + +/* grib_accessor_class_int16_little_endian.c */ + +/* grib_accessor_class_int32.c */ + +/* grib_accessor_class_int32_little_endian.c */ + +/* grib_accessor_class_int64.c */ + +/* grib_accessor_class_int64_little_endian.c */ + +/* grib_accessor_class_int8.c */ + +/* grib_accessor_class_uint16.c */ + +/* grib_accessor_class_uint16_little_endian.c */ + +/* grib_accessor_class_uint32.c */ + +/* grib_accessor_class_uint32_little_endian.c */ + +/* grib_accessor_class_uint64.c */ + +/* grib_accessor_class_uint64_little_endian.c */ + +/* grib_accessor_class_uint8.c */ + +/* grib_accessor_class_blob.c */ + /* grib_accessor_class_julian_day.c */ /* grib_accessor_class_latlonvalues.c */ @@ -930,12 +1079,12 @@ grib_handle *grib_handle_new_from_message(grib_context *c, void *data, size_t bu grib_handle *grib_handle_new_from_multi_message(grib_context *c, void **data, size_t *buflen, int *error); grib_handle *grib_handle_new_from_file(grib_context *c, FILE *f, int *error); grib_handle *grib_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *gts_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *taf_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *metar_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *codes_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *bufr_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); -grib_handle *any_new_from_file(grib_context *c, FILE *f, int headers_only, int *error); +grib_handle *gts_new_from_file(grib_context *c, FILE *f, int *error); +grib_handle *taf_new_from_file(grib_context *c, FILE *f, int *error); +grib_handle *metar_new_from_file(grib_context *c, FILE *f, int *error); +grib_handle *codes_new_from_file(grib_context *c, FILE *f, int *error); +grib_handle *bufr_new_from_file(grib_context *c, FILE *f, int *error); +grib_handle *any_new_from_file(grib_context *c, FILE *f, int *error); grib_multi_handle *grib_multi_handle_new(grib_context *c); int grib_multi_handle_delete(grib_multi_handle *h); int grib_multi_handle_append(grib_handle *h, int start_section, grib_multi_handle *mh); @@ -1025,6 +1174,10 @@ int grib_keys_iterator_next(grib_keys_iterator *kiter); const char *grib_keys_iterator_get_name(grib_keys_iterator *kiter); grib_accessor *grib_keys_iterator_get_accessor(grib_keys_iterator *kiter); int grib_keys_iterator_delete(grib_keys_iterator *kiter); +int grib_keys_iterator_get_long(grib_keys_iterator *kiter, long *v, size_t *len); +int grib_keys_iterator_get_double(grib_keys_iterator *kiter, double *v, size_t *len); +int grib_keys_iterator_get_string(grib_keys_iterator *kiter, char *v, size_t *len); +int grib_keys_iterator_get_bytes(grib_keys_iterator *kiter, unsigned char *v, size_t *len); int grib_keys_iterator_get_native_type(grib_keys_iterator *kiter); /* grib_parse_utils.c */ @@ -1324,6 +1477,9 @@ const char *grib_binop_double_proc_name(grib_binop_double_proc proc); const char *grib_unop_long_proc_name(grib_unop_long_proc proc); const char *grib_unop_double_proc_name(grib_unop_double_proc proc); +/* grib_api_version.c */ +const char *grib_get_git_sha1(void); + /* grib_bits_any_endian.c */ int grib_is_all_bits_one(long val, long nbits); char *grib_decode_string(const unsigned char *bitStream, long *bitOffset, size_t numberOfCharacters, char *string); diff --git a/src/grib_handle.c b/src/grib_handle.c index e3d01da68..5b4355271 100644 --- a/src/grib_handle.c +++ b/src/grib_handle.c @@ -723,7 +723,7 @@ grib_handle* grib_new_from_file ( grib_context* c, FILE* f,int headers_only,int } -grib_handle* gts_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) +grib_handle* gts_new_from_file ( grib_context* c, FILE* f,int *error ) { void *data = NULL; size_t olen = 0; @@ -732,7 +732,7 @@ grib_handle* gts_new_from_file ( grib_context* c, FILE* f,int headers_only,int * if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_gts_from_file_malloc ( f, headers_only,&olen,&offset,error ); + data = wmo_read_gts_from_file_malloc ( f, 0,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -742,11 +742,7 @@ grib_handle* gts_new_from_file ( grib_context* c, FILE* f,int headers_only,int * return NULL; } - if (headers_only) { - gl = grib_handle_new_from_partial_message ( c, data, olen ); - } else { - gl = grib_handle_new_from_message ( c, data, olen ); - } + gl = grib_handle_new_from_message ( c, data, olen ); if ( !gl ) { @@ -764,7 +760,7 @@ grib_handle* gts_new_from_file ( grib_context* c, FILE* f,int headers_only,int * return gl; } -grib_handle* taf_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) +grib_handle* taf_new_from_file ( grib_context* c, FILE* f,int *error ) { void *data = NULL; size_t olen = 0; @@ -773,7 +769,7 @@ grib_handle* taf_new_from_file ( grib_context* c, FILE* f,int headers_only,int * if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_taf_from_file_malloc ( f, headers_only,&olen,&offset,error ); + data = wmo_read_taf_from_file_malloc ( f, 0,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -783,11 +779,7 @@ grib_handle* taf_new_from_file ( grib_context* c, FILE* f,int headers_only,int * return NULL; } - if (headers_only) { - gl = grib_handle_new_from_partial_message ( c, data, olen ); - } else { - gl = grib_handle_new_from_message ( c, data, olen ); - } + gl = grib_handle_new_from_message ( c, data, olen ); if ( !gl ) { @@ -805,7 +797,7 @@ grib_handle* taf_new_from_file ( grib_context* c, FILE* f,int headers_only,int * return gl; } -grib_handle* metar_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) +grib_handle* metar_new_from_file ( grib_context* c, FILE* f,int *error ) { void *data = NULL; size_t olen = 0; @@ -814,7 +806,7 @@ grib_handle* metar_new_from_file ( grib_context* c, FILE* f,int headers_only,int if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_metar_from_file_malloc ( f, headers_only,&olen,&offset,error ); + data = wmo_read_metar_from_file_malloc ( f, 0,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -824,11 +816,7 @@ grib_handle* metar_new_from_file ( grib_context* c, FILE* f,int headers_only,int return NULL; } - if (headers_only) { - gl = grib_handle_new_from_partial_message ( c, data, olen ); - } else { - gl = grib_handle_new_from_message ( c, data, olen ); - } + gl = grib_handle_new_from_message ( c, data, olen ); if ( !gl ) { @@ -846,7 +834,7 @@ grib_handle* metar_new_from_file ( grib_context* c, FILE* f,int headers_only,int return gl; } -grib_handle* codes_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) +grib_handle* codes_new_from_file ( grib_context* c, FILE* f,int *error ) { void *data = NULL; size_t olen = 0; @@ -855,7 +843,7 @@ grib_handle* codes_new_from_file ( grib_context* c, FILE* f,int headers_only,int if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_any_from_file_malloc ( f, headers_only,&olen,&offset,error ); + data = wmo_read_any_from_file_malloc ( f, 0,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -865,11 +853,7 @@ grib_handle* codes_new_from_file ( grib_context* c, FILE* f,int headers_only,int return NULL; } - if (headers_only) { - gl = grib_handle_new_from_partial_message ( c, data, olen ); - } else { - gl = grib_handle_new_from_message ( c, data, olen ); - } + gl = grib_handle_new_from_message ( c, data, olen ); if ( !gl ) { @@ -888,7 +872,7 @@ grib_handle* codes_new_from_file ( grib_context* c, FILE* f,int headers_only,int } -grib_handle* bufr_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) +grib_handle* bufr_new_from_file ( grib_context* c, FILE* f,int *error ) { void *data = NULL; size_t olen = 0; @@ -897,7 +881,7 @@ grib_handle* bufr_new_from_file ( grib_context* c, FILE* f,int headers_only,int if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_bufr_from_file_malloc ( f, headers_only,&olen,&offset,error ); + data = wmo_read_bufr_from_file_malloc ( f, 0,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -907,11 +891,7 @@ grib_handle* bufr_new_from_file ( grib_context* c, FILE* f,int headers_only,int return NULL; } - if (headers_only) { - gl = grib_handle_new_from_partial_message ( c, data, olen ); - } else { - gl = grib_handle_new_from_message ( c, data, olen ); - } + gl = grib_handle_new_from_message ( c, data, olen ); if ( !gl ) { @@ -929,7 +909,7 @@ grib_handle* bufr_new_from_file ( grib_context* c, FILE* f,int headers_only,int return gl; } -grib_handle* any_new_from_file ( grib_context* c, FILE* f,int headers_only,int *error ) +grib_handle* any_new_from_file ( grib_context* c, FILE* f,int *error ) { void *data = NULL; size_t olen = 0; @@ -938,7 +918,7 @@ grib_handle* any_new_from_file ( grib_context* c, FILE* f,int headers_only,int * if ( c == NULL ) c = grib_context_get_default(); - data = wmo_read_any_from_file_malloc ( f, headers_only,&olen,&offset,error ); + data = wmo_read_any_from_file_malloc ( f, 0,&olen,&offset,error ); if ( *error != GRIB_SUCCESS ) { @@ -948,11 +928,7 @@ grib_handle* any_new_from_file ( grib_context* c, FILE* f,int headers_only,int * return NULL; } - if (headers_only) { - gl = grib_handle_new_from_partial_message ( c, data, olen ); - } else { - gl = grib_handle_new_from_message ( c, data, olen ); - } + gl = grib_handle_new_from_message ( c, data, olen ); if ( !gl ) { diff --git a/src/grib_io.c b/src/grib_io.c index 50c34f551..c57be50c2 100644 --- a/src/grib_io.c +++ b/src/grib_io.c @@ -694,7 +694,10 @@ static int read_BUFR(reader *r) /* fprintf(stderr," sec1len=%d sec2len=%d sec3len=%d sec4len=%d\n",sec1len, sec2len,sec3len,sec4len); */ length = 4 + sec1len + sec2len + sec3len + sec4len + 4; /* fprintf(stderr,"length = %d i = %d\n",length,i); */ - } else if (r->headers_only) { + } + #if 0 + /* reading only headers is disabled for BUFR for the moment */ + else if (r->headers_only) { /* Section 1 */ for(j=0;j<3;j++) { @@ -731,6 +734,7 @@ static int read_BUFR(reader *r) err=r->seek(r->read_data,length-i-1); length=i; } + #endif /* Assert(i <= sizeof(tmp)); */ err=read_the_rest(r, length, tmp, i, 1); diff --git a/tools/bufr_compare.c b/tools/bufr_compare.c index a79bda15b..6eb4b134e 100644 --- a/tools/bufr_compare.c +++ b/tools/bufr_compare.c @@ -345,7 +345,7 @@ static void print_index_key_values(grib_index* index,int counter,const char* err static grib_handle* grib_handle_new_from_file_x(grib_context* c,FILE* f,int mode,int headers_only,int *err) { - return bufr_new_from_file(c,f,headers_only,err); + return bufr_new_from_file(c,f,err); } int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { diff --git a/tools/grib_tools.c b/tools/grib_tools.c index f89256bfa..d8f7f0906 100644 --- a/tools/grib_tools.c +++ b/tools/grib_tools.c @@ -112,24 +112,24 @@ grib_runtime_options options={ static grib_handle* grib_handle_new_from_file_x(grib_context* c,FILE* f,int mode,int headers_only,int *err) { if (mode==MODE_ANY) - return any_new_from_file(c,f,headers_only,err); + return any_new_from_file(c,f,err); if (mode==MODE_GTS) - return gts_new_from_file(c,f,headers_only,err); + return gts_new_from_file(c,f,err); if (mode==MODE_BUFR) - return bufr_new_from_file(c,f,headers_only,err); + return bufr_new_from_file(c,f,err); if (mode==MODE_METAR) - return metar_new_from_file(c,f,headers_only,err); + return metar_new_from_file(c,f,err); if (mode==MODE_TAF) - return taf_new_from_file(c,f,headers_only,err); + return taf_new_from_file(c,f,err); if (mode==MODE_GRIB) return grib_new_from_file(c,f,headers_only,err); - return codes_new_from_file(c,f,headers_only,err); + return codes_new_from_file(c,f,err); } int grib_tool(int argc, char **argv)