From 3d188bebbf4e9d7b4d328250baed3b8f869f0fd8 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 22 Jan 2020 14:48:06 +0000 Subject: [PATCH] Applied clang-format (Part 2) --- src/action_class_write.c | 4 +- src/grib_accessor_class_apply_operators.c | 16 ++----- src/grib_accessor_class_ascii.c | 4 +- src/grib_accessor_class_bufr_data_element.c | 8 +--- src/grib_accessor_class_bufr_elements_table.c | 32 ++++--------- ...accessor_class_bufr_extract_area_subsets.c | 8 +--- ...ssor_class_bufr_extract_datetime_subsets.c | 14 +----- ...cessor_class_bufrdc_expanded_descriptors.c | 4 +- src/grib_accessor_class_codetable.c | 32 ++++--------- src/grib_accessor_class_data_2order_packing.c | 2 - ..._g1second_order_general_extended_packing.c | 4 +- ...rib_accessor_class_data_g22order_packing.c | 8 +--- src/grib_accessor_class_dictionary.c | 48 +++++-------------- ...grib_accessor_class_expanded_descriptors.c | 4 +- src/grib_accessor_class_g1_message_length.c | 1 - ...accessor_class_g1end_of_interval_monthly.c | 4 +- src/grib_accessor_class_g1step_range.c | 16 ++----- src/grib_accessor_class_g2_aerosol.c | 4 +- src/grib_accessor_class_g2_chemical.c | 4 +- src/grib_accessor_class_g2_eps.c | 4 +- src/grib_accessor_class_g2_mars_labeling.c | 4 +- src/grib_accessor_class_g2end_step.c | 16 ++----- src/grib_accessor_class_g2level.c | 12 ++--- src/grib_accessor_class_gaussian_grid_name.c | 4 +- src/grib_accessor_class_group.c | 4 +- src/grib_accessor_class_hash_array.c | 8 +--- src/grib_accessor_class_ksec1expver.c | 4 +- src/grib_accessor_class_library_version.c | 4 +- src/grib_accessor_class_local_definition.c | 4 +- src/grib_accessor_class_lookup.c | 12 ++--- src/grib_accessor_class_mars_step.c | 12 ++--- src/grib_accessor_class_non_alpha.c | 4 +- ...accessor_class_number_of_points_gaussian.c | 9 +--- src/grib_accessor_class_sexagesimal2decimal.c | 5 +- src/grib_accessor_class_smart_table.c | 40 ++++------------ src/grib_accessor_class_smart_table_column.c | 4 +- src/grib_accessor_class_to_double.c | 12 ++--- src/grib_accessor_class_to_integer.c | 8 +--- src/grib_accessor_class_to_string.c | 8 +--- src/grib_accessor_class_variable.c | 4 +- src/grib_bits_fast_big_endian.c | 4 +- src/grib_concept_index.c | 6 +-- src/grib_dumper_class_bufr_encode_fortran.c | 4 +- src/grib_dumper_class_default.c | 1 - src/grib_dumper_class_json.c | 4 +- src/grib_dumper_class_serialize.c | 4 +- src/grib_expression_class_accessor.c | 4 +- src/grib_expression_class_is_in_dict.c | 22 ++------- src/grib_expression_class_is_in_list.c | 16 ++----- src/grib_expression_class_is_integer.c | 4 +- src/grib_expression_class_length.c | 12 ++--- src/grib_expression_class_sub_string.c | 6 +-- src/grib_index.c | 3 +- src/grib_iterator_class_polar_stereographic.c | 8 +--- src/grib_jasper_encoding.c | 4 +- src/grib_nearest.c | 20 ++------ src/grib_openjpeg_encoding.c | 40 ++++------------ src/grib_parse_utils.c | 24 +++------- src/grib_query.c | 8 +--- src/grib_vdarray.c | 4 +- 60 files changed, 145 insertions(+), 452 deletions(-) diff --git a/src/action_class_write.c b/src/action_class_write.c index 3681f1881..76f6cb560 100644 --- a/src/action_class_write.c +++ b/src/action_class_write.c @@ -111,9 +111,7 @@ static int execute(grib_action* act, grib_handle* h) size_t size; const void* buffer = NULL; const char* filename = NULL; - char string[1024] = { - 0, - }; + char string[1024] = {0,}; grib_file* of = NULL; diff --git a/src/grib_accessor_class_apply_operators.c b/src/grib_accessor_class_apply_operators.c index 86554dcd0..015ef3241 100644 --- a/src/grib_accessor_class_apply_operators.c +++ b/src/grib_accessor_class_apply_operators.c @@ -342,12 +342,8 @@ static int apply_operators(grib_accessor* a) char* associatedFieldType = "long"; char* associatedFieldUnit = "CODE TABLE 31021"; long associatedFieldDescriptor = 99999; - long delayedReplication[MAX_DELAYED_REPLICATION_COUNT] = { - 0, - }; - long delayedReplicationIndex[MAX_DELAYED_REPLICATION_COUNT] = { - 0, - }; + long delayedReplication[MAX_DELAYED_REPLICATION_COUNT] = {0,}; + long delayedReplicationIndex[MAX_DELAYED_REPLICATION_COUNT] = {0,}; long delayedReplicationCount = 0; long iassociatedInfoNumber = 0; int id = 0; @@ -632,9 +628,7 @@ static int apply_operators(grib_accessor* a) static void long_to_string(grib_context* c, long* v, size_t len, char** val) { size_t i; - char tmp[1024] = { - 0, - }; + char tmp[1024] = {0,}; for (i = 0; i < len; i++) { sprintf(tmp, "%ld", v[i]); val[i] = grib_context_strdup(c, tmp); @@ -644,9 +638,7 @@ static void long_to_string(grib_context* c, long* v, size_t len, char** val) static void double_to_string(grib_context* c, double* v, size_t len, char** val) { size_t i; - char tmp[1024] = { - 0, - }; + char tmp[1024] = {0,}; for (i = 0; i < len; i++) { sprintf(tmp, "%g", v[i]); val[i] = grib_context_strdup(c, tmp); diff --git a/src/grib_accessor_class_ascii.c b/src/grib_accessor_class_ascii.c index 39214efbf..f939c41fb 100644 --- a/src/grib_accessor_class_ascii.c +++ b/src/grib_accessor_class_ascii.c @@ -215,9 +215,7 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len) static int unpack_long(grib_accessor* a, long* v, size_t* len) { - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); size_t i = 0; char* last = NULL; diff --git a/src/grib_accessor_class_bufr_data_element.c b/src/grib_accessor_class_bufr_data_element.c index c6e15093a..b66db443f 100644 --- a/src/grib_accessor_class_bufr_data_element.c +++ b/src/grib_accessor_class_bufr_data_element.c @@ -166,9 +166,7 @@ static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) grib_accessor_bufr_data_element* self; char* copied_name = NULL; int i; - grib_action creator = { - 0, - }; + grib_action creator = {0,}; creator.op = "bufr_data_element"; creator.name_space = ""; creator.set = 0; @@ -352,9 +350,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) char* str = NULL; char* p = 0; size_t slen = 0; - char sval[100] = { - 0, - }; + char sval[100] = {0,}; double dval = 0; size_t dlen = 1; diff --git a/src/grib_accessor_class_bufr_elements_table.c b/src/grib_accessor_class_bufr_elements_table.c index 8c3557d24..d21077c4b 100644 --- a/src/grib_accessor_class_bufr_elements_table.c +++ b/src/grib_accessor_class_bufr_elements_table.c @@ -185,18 +185,10 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) grib_accessor_bufr_elements_table* self = (grib_accessor_bufr_elements_table*)a; char* filename = NULL; - char line[1024] = { - 0, - }; - char masterDir[1024] = { - 0, - }; - char localDir[1024] = { - 0, - }; - char dictName[1024] = { - 0, - }; + char line[1024] = {0,}; + char masterDir[1024] = {0,}; + char localDir[1024] = {0,}; + char dictName[1024] = {0,}; char* localFilename = 0; char** list = 0; size_t len = 1024; @@ -218,12 +210,8 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) GRIB_MUTEX_LOCK(&mutex1); if (*masterDir != 0) { - char name[4096] = { - 0, - }; - char recomposed[4096] = { - 0, - }; + char name[4096] = {0,}; + char recomposed[4096] = {0,}; sprintf(name, "%s/%s", masterDir, self->dictionary); grib_recompose_name(h, NULL, name, recomposed, 0); filename = grib_context_full_defs_path(c, recomposed); @@ -233,12 +221,8 @@ static grib_trie* load_bufr_elements_table(grib_accessor* a, int* err) } if (*localDir != 0) { - char localRecomposed[1024] = { - 0, - }; - char localName[2048] = { - 0, - }; + char localRecomposed[1024] = {0,}; + char localName[2048] = {0,}; sprintf(localName, "%s/%s", localDir, self->dictionary); grib_recompose_name(h, NULL, localName, localRecomposed, 0); localFilename = grib_context_full_defs_path(c, localRecomposed); diff --git a/src/grib_accessor_class_bufr_extract_area_subsets.c b/src/grib_accessor_class_bufr_extract_area_subsets.c index 7aa7fddf6..efbb6f6c0 100644 --- a/src/grib_accessor_class_bufr_extract_area_subsets.c +++ b/src/grib_accessor_class_bufr_extract_area_subsets.c @@ -196,12 +196,8 @@ static int select_area(grib_accessor* a) grib_iarray* subsets; long* subsets_ar = 0; size_t nsubsets = 0; - char latstr[20] = { - 0, - }; - char lonstr[20] = { - 0, - }; + char latstr[20] = {0,}; + char lonstr[20] = {0,}; ret = grib_get_long(h, "compressedData", &compressed); if (ret) diff --git a/src/grib_accessor_class_bufr_extract_datetime_subsets.c b/src/grib_accessor_class_bufr_extract_datetime_subsets.c index 66738cd6b..4d7482bb7 100644 --- a/src/grib_accessor_class_bufr_extract_datetime_subsets.c +++ b/src/grib_accessor_class_bufr_extract_datetime_subsets.c @@ -205,9 +205,7 @@ static int build_long_array(grib_context* c, grib_handle* h, int compressed, } else { /* uncompressed */ - char keystr[20] = { - 0, - }; + char keystr[20] = {0,}; size_t values_len = 0; for (i = 0; i < numberOfSubsets; ++i) { long lVal = 0; @@ -235,15 +233,7 @@ static int select_datetime(grib_accessor* a) grib_context* c = h->context; size_t n; double julianStart = 0, julianEnd = 0, julianDT = 0; - char start_str[80] = { - 0, - }, - end_str[80] = { - 0, - }, - datetime_str[80] = { - 0, - }; + char start_str[80] = {0,}, end_str[80] = {0,}, datetime_str[80] = {0,}; long yearRank, monthRank, dayRank, hourRank, minuteRank, secondRank; long yearStart, monthStart, dayStart, hourStart, minuteStart, secondStart; long yearEnd, monthEnd, dayEnd, hourEnd, minuteEnd, secondEnd; diff --git a/src/grib_accessor_class_bufrdc_expanded_descriptors.c b/src/grib_accessor_class_bufrdc_expanded_descriptors.c index 2d26cf0b3..fde586436 100644 --- a/src/grib_accessor_class_bufrdc_expanded_descriptors.c +++ b/src/grib_accessor_class_bufrdc_expanded_descriptors.c @@ -202,9 +202,7 @@ static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) grib_context* c = a->context; long l = 0; size_t size, i; - char buf[25] = { - 0, - }; + char buf[25] = {0,}; long* v = 0; descriptors = get_accessor(a); diff --git a/src/grib_accessor_class_codetable.c b/src/grib_accessor_class_codetable.c index 8896ac3b8..38b47986f 100644 --- a/src/grib_accessor_class_codetable.c +++ b/src/grib_accessor_class_codetable.c @@ -298,19 +298,11 @@ static grib_codetable* load_table(grib_accessor_codetable* self) grib_codetable* next = NULL; grib_accessor* a = (grib_accessor*)self; char* filename = 0; - char recomposed[1024] = { - 0, - }; - char localRecomposed[1024] = { - 0, - }; + char recomposed[1024] = {0,}; + char localRecomposed[1024] = {0,}; char* localFilename = 0; - char masterDir[1024] = { - 0, - }; - char localDir[1024] = { - 0, - }; + char masterDir[1024] = {0,}; + char localDir[1024] = {0,}; size_t len = 1024; if (self->masterDir != NULL) @@ -321,9 +313,7 @@ static grib_codetable* load_table(grib_accessor_codetable* self) grib_get_string(h, self->localDir, localDir, &len); if (*masterDir != 0) { - char name[2048] = { - 0, - }; + char name[2048] = {0,}; sprintf(name, "%s/%s", masterDir, self->tablename); grib_recompose_name(h, NULL, name, recomposed, 0); filename = grib_context_full_defs_path(c, recomposed); @@ -334,9 +324,7 @@ static grib_codetable* load_table(grib_accessor_codetable* self) } if (*localDir != 0) { - char localName[2048] = { - 0, - }; + char localName[2048] = {0,}; sprintf(localName, "%s/%s", localDir, self->tablename); grib_recompose_name(h, NULL, localName, localRecomposed, 0); localFilename = grib_context_full_defs_path(c, localRecomposed); @@ -431,12 +419,8 @@ static int grib_load_codetable(grib_context* c, const char* filename, while (fgets(line, sizeof(line) - 1, f)) { char* p = line; int code = 0; - char abbreviation[1024] = { - 0, - }; - char title[1024] = { - 0, - }; + char abbreviation[1024] = {0,}; + char title[1024] = {0,}; char* q = abbreviation; char* r = title; char* units = 0; diff --git a/src/grib_accessor_class_data_2order_packing.c b/src/grib_accessor_class_data_2order_packing.c index a8044834c..a199afc01 100644 --- a/src/grib_accessor_class_data_2order_packing.c +++ b/src/grib_accessor_class_data_2order_packing.c @@ -962,10 +962,8 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) #if KEEP_OLD == 1 #else - grib_free_second_order_groups(a->context, sd); #endif - ; grib_context_free(a->context, buf); grib_context_free(a->context, sec_val); diff --git a/src/grib_accessor_class_data_g1second_order_general_extended_packing.c b/src/grib_accessor_class_data_g1second_order_general_extended_packing.c index 807d01db6..ff5183b16 100644 --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.c +++ b/src/grib_accessor_class_data_g1second_order_general_extended_packing.c @@ -1830,9 +1830,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) pos = 0; if (orderOfSPD) { - long SPD[4] = { - 0, - }; + long SPD[4] = {0,}; size_t nSPD = orderOfSPD + 1; Assert(orderOfSPD <= 3); for (i = 0; i < orderOfSPD; i++) diff --git a/src/grib_accessor_class_data_g22order_packing.c b/src/grib_accessor_class_data_g22order_packing.c index 6e357b5e3..e0120d460 100644 --- a/src/grib_accessor_class_data_g22order_packing.c +++ b/src/grib_accessor_class_data_g22order_packing.c @@ -653,9 +653,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) if (orderOfSpatialDifferencing) { long bias = 0; - unsigned long extras[2] = { - 0, - }; + unsigned long extras[2] = {0,}; ref_p = 0; /* For Complex packing, order == 0 */ @@ -752,9 +750,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) long maxgrw; long maxgrl; - char packingType[254] = { - 0, - }; + char packingType[254] = {0,}; size_t slen = 254; if (*len == 0) diff --git a/src/grib_accessor_class_dictionary.c b/src/grib_accessor_class_dictionary.c index e330fcb33..a502a5c7f 100644 --- a/src/grib_accessor_class_dictionary.c +++ b/src/grib_accessor_class_dictionary.c @@ -159,21 +159,11 @@ static grib_trie* load_dictionary(grib_context* c, grib_accessor* a, int* err) grib_accessor_dictionary* self = (grib_accessor_dictionary*)a; char* filename = NULL; - char line[1024] = { - 0, - }; - char key[1024] = { - 0, - }; - char masterDir[1024] = { - 0, - }; - char localDir[1024] = { - 0, - }; - char dictName[1024] = { - 0, - }; + char line[1024] = {0,}; + char key[1024] = {0,}; + char masterDir[1024] = {0,}; + char localDir[1024] = {0,}; + char dictName[1024] = {0,}; char* localFilename = 0; char* list = 0; size_t len = 1024; @@ -192,12 +182,8 @@ static grib_trie* load_dictionary(grib_context* c, grib_accessor* a, int* err) grib_get_string(h, self->localDir, localDir, &len); if (*masterDir != 0) { - char name[2048] = { - 0, - }; - char recomposed[2048] = { - 0, - }; + char name[2048] = {0,}; + char recomposed[2048] = {0,}; sprintf(name, "%s/%s", masterDir, self->dictionary); grib_recompose_name(h, NULL, name, recomposed, 0); filename = grib_context_full_defs_path(c, recomposed); @@ -207,12 +193,8 @@ static grib_trie* load_dictionary(grib_context* c, grib_accessor* a, int* err) } if (*localDir != 0) { - char localName[2048] = { - 0, - }; - char localRecomposed[1024] = { - 0, - }; + char localName[2048] = {0,}; + char localRecomposed[1024] = {0,}; sprintf(localName, "%s/%s", localDir, self->dictionary); grib_recompose_name(h, NULL, localName, localRecomposed, 0); localFilename = grib_context_full_defs_path(c, localRecomposed); @@ -306,9 +288,7 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len) { grib_accessor_dictionary* self = (grib_accessor_dictionary*)a; int err = GRIB_SUCCESS; - char key[1024] = { - 0, - }; + char key[1024] = {0,}; size_t size = 1024; char* list = NULL; char* start = NULL; @@ -377,9 +357,7 @@ static int get_native_type(grib_accessor* a) static int unpack_long(grib_accessor* a, long* val, size_t* len) { int err = 0; - char buffer[1024] = { - 0, - }; + char buffer[1024] = {0,}; size_t size = 1024; err = unpack_string(a, buffer, &size); @@ -395,9 +373,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len) static int unpack_double(grib_accessor* a, double* val, size_t* len) { int err = 0; - char buffer[1024] = { - 0, - }; + char buffer[1024] = {0,}; size_t size = 1024; err = unpack_string(a, buffer, &size); diff --git a/src/grib_accessor_class_expanded_descriptors.c b/src/grib_accessor_class_expanded_descriptors.c index 7a8de748f..d8eb2ea13 100644 --- a/src/grib_accessor_class_expanded_descriptors.c +++ b/src/grib_accessor_class_expanded_descriptors.c @@ -590,9 +590,7 @@ static int expand(grib_accessor* a) /* grib_iarray* unexp=0; */ int i; long* u = 0; - char key[50] = { - 0, - }; + char key[50] = {0,}; long centre, masterTablesVersionNumber, localTablesVersionNumber, masterTablesNumber; change_coding_params ccp; bufr_descriptors_array* unexpanded = NULL; diff --git a/src/grib_accessor_class_g1_message_length.c b/src/grib_accessor_class_g1_message_length.c index 327a9b7b5..7939e8880 100644 --- a/src/grib_accessor_class_g1_message_length.c +++ b/src/grib_accessor_class_g1_message_length.c @@ -172,7 +172,6 @@ int grib_get_g1_message_size(grib_handle* h, grib_accessor* tl, grib_accessor* s tlen += 4; slen = tlen - s4->offset - 4; /* 4 is for 7777 */ - ; /*printf("DECODING large grib total=%ld section4=%ld\n",tlen,slen);*/ } diff --git a/src/grib_accessor_class_g1end_of_interval_monthly.c b/src/grib_accessor_class_g1end_of_interval_monthly.c index 8cd1667cb..91963856b 100644 --- a/src/grib_accessor_class_g1end_of_interval_monthly.c +++ b/src/grib_accessor_class_g1end_of_interval_monthly.c @@ -158,9 +158,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) { grib_accessor_g1end_of_interval_monthly* self = (grib_accessor_g1end_of_interval_monthly*)a; int ret = 0; - char verifyingMonth[7] = { - 0, - }; + char verifyingMonth[7] = {0,}; size_t slen = 7; long year = 0, month = 0, date = 0; long mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; diff --git a/src/grib_accessor_class_g1step_range.c b/src/grib_accessor_class_g1step_range.c index 0e61baea3..cd1489c90 100644 --- a/src/grib_accessor_class_g1step_range.c +++ b/src/grib_accessor_class_g1step_range.c @@ -232,9 +232,7 @@ int grib_g1_step_get_steps(grib_accessor* a, long* start, long* theEnd) int err = 0; long p1 = 0, p2 = 0, unit = 0, timeRangeIndicator = 0, timeRangeIndicatorFromStepRange = 0; long step_unit = 1; - char stepType[20] = { - 0, - }; + char stepType[20] = {0,}; size_t stepTypeLen = 20; long newstart, newend; int factor = 1; @@ -333,9 +331,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) long timeRangeIndicator = 0; long unit; int err = 0; - char stepType[20] = { - 0, - }; + char stepType[20] = {0,}; size_t stepTypeLen = 20; grib_handle* hand = grib_handle_of_accessor(a); @@ -487,9 +483,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) long end_sec, start_sec; char *p = NULL, *q = NULL; int instant = 0; - char stepType[20] = { - 0, - }; + char stepType[20] = {0,}; size_t stepTypeLen = 20; if (self->stepType) { @@ -653,9 +647,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) char* p = sval; size_t svallen = 100; grib_accessor_g1step_range* self = (grib_accessor_g1step_range*)a; - char stepType[20] = { - 0, - }; + char stepType[20] = {0,}; size_t stepTypeLen = 20; long step_unit = 0; int err = 0; diff --git a/src/grib_accessor_class_g2_aerosol.c b/src/grib_accessor_class_g2_aerosol.c index f7c9b638e..8ed857602 100644 --- a/src/grib_accessor_class_g2_aerosol.c +++ b/src/grib_accessor_class_g2_aerosol.c @@ -172,9 +172,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) /*long type=-1; long stream=-1;*/ long eps = -1; - char stepType[15] = { - 0, - }; + char stepType[15] = {0,}; size_t slen = 15; /*int aerosol = *val;*/ int isInstant = 0; diff --git a/src/grib_accessor_class_g2_chemical.c b/src/grib_accessor_class_g2_chemical.c index c12c62382..99be283a8 100644 --- a/src/grib_accessor_class_g2_chemical.c +++ b/src/grib_accessor_class_g2_chemical.c @@ -172,9 +172,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) /*long type=-1; long stream=-1;*/ long eps = -1; - char stepType[15] = { - 0, - }; + char stepType[15] = {0,}; size_t slen = 15; /*int chemical = *val;*/ int isInstant = 0; diff --git a/src/grib_accessor_class_g2_eps.c b/src/grib_accessor_class_g2_eps.c index 84aa35873..66bd28a54 100644 --- a/src/grib_accessor_class_g2_eps.c +++ b/src/grib_accessor_class_g2_eps.c @@ -183,9 +183,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) long stream = -1; long chemical = -1; long aerosol = -1; - char stepType[15] = { - 0, - }; + char stepType[15] = {0,}; size_t slen = 15; int eps = *val; int isInstant = 0; diff --git a/src/grib_accessor_class_g2_mars_labeling.c b/src/grib_accessor_class_g2_mars_labeling.c index 86613944c..c829751d7 100644 --- a/src/grib_accessor_class_g2_mars_labeling.c +++ b/src/grib_accessor_class_g2_mars_labeling.c @@ -228,9 +228,7 @@ static int extra_set(grib_accessor* a, long val) int ret = 0; grib_accessor_g2_mars_labeling* self = (grib_accessor_g2_mars_labeling*)a; grib_handle* hand = grib_handle_of_accessor(a); - char stepType[30] = { - 0, - }; + char stepType[30] = {0,}; size_t stepTypelen = 30; long derivedForecast = -1; long productDefinitionTemplateNumberNew = -1; diff --git a/src/grib_accessor_class_g2end_step.c b/src/grib_accessor_class_g2end_step.c index 56441057c..74851f87c 100644 --- a/src/grib_accessor_class_g2end_step.c +++ b/src/grib_accessor_class_g2end_step.c @@ -243,9 +243,7 @@ static const int u2s[] = { static int is_special_expver(grib_handle* h) { int ret = 0; - char strExpVer[50] = { - 0, - }; + char strExpVer[50] = {0,}; size_t slen = 50; ret = grib_get_string(h, "experimentVersionNumber", strExpVer, &slen); if (ret == GRIB_SUCCESS && !strcmp(strExpVer, "1605")) { @@ -345,15 +343,9 @@ static int unpack_multiple_time_ranges(grib_accessor* a, long* val, size_t* len) long numberOfTimeRange = 0, unit = 0, start_step = 0; size_t count = 0; - long arr_typeOfTimeIncrement[MAX_NUM_TIME_RANGES] = { - 0, - }; - long arr_coded_unit[MAX_NUM_TIME_RANGES] = { - 0, - }; - long arr_coded_time_range[MAX_NUM_TIME_RANGES] = { - 0, - }; + long arr_typeOfTimeIncrement[MAX_NUM_TIME_RANGES] = {0,}; + long arr_coded_unit[MAX_NUM_TIME_RANGES] = {0,}; + long arr_coded_time_range[MAX_NUM_TIME_RANGES] = {0,}; if ((err = grib_get_long_internal(h, self->start_step, &start_step))) return err; diff --git a/src/grib_accessor_class_g2level.c b/src/grib_accessor_class_g2level.c index 99ebca8f5..9be8ed369 100644 --- a/src/grib_accessor_class_g2level.c +++ b/src/grib_accessor_class_g2level.c @@ -162,9 +162,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len) long type_first = 0; long scale_first = 0; long value_first = 0; - char pressure_units[10] = { - 0, - }; + char pressure_units[10] = {0,}; size_t pressure_units_len = 10; double v; @@ -245,9 +243,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) double value_first = *val; long scale_first = 0; long type_first = 0; - char pressure_units[10] = { - 0, - }; + char pressure_units[10] = {0,}; size_t pressure_units_len = 10; if (*len != 1) @@ -295,9 +291,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) long value_first = *val; long scale_first = 0; long type_first = 0; - char pressure_units[10] = { - 0, - }; + char pressure_units[10] = {0,}; size_t pressure_units_len = 10; grib_accessor_g2level* self = (grib_accessor_g2level*)a; diff --git a/src/grib_accessor_class_gaussian_grid_name.c b/src/grib_accessor_class_gaussian_grid_name.c index 8c18175cb..e306027d0 100644 --- a/src/grib_accessor_class_gaussian_grid_name.c +++ b/src/grib_accessor_class_gaussian_grid_name.c @@ -159,9 +159,7 @@ static int unpack_string(grib_accessor* a, char* v, size_t* len) grib_accessor_gaussian_grid_name* self = (grib_accessor_gaussian_grid_name*)a; long N = 0, Ni = 0, isOctahedral = 0; - char tmp[MAX_GRIDNAME_LEN] = { - 0, - }; + char tmp[MAX_GRIDNAME_LEN] = {0,}; size_t length = sizeof(tmp); int ret = GRIB_SUCCESS; diff --git a/src/grib_accessor_class_group.c b/src/grib_accessor_class_group.c index 5dd577d8c..3651d15dd 100644 --- a/src/grib_accessor_class_group.c +++ b/src/grib_accessor_class_group.c @@ -238,9 +238,7 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len) static int unpack_long(grib_accessor* a, long* v, size_t* len) { - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); size_t i = 0; char* last = NULL; diff --git a/src/grib_accessor_class_hash_array.c b/src/grib_accessor_class_hash_array.c index dda062447..d5b8d57b7 100644 --- a/src/grib_accessor_class_hash_array.c +++ b/src/grib_accessor_class_hash_array.c @@ -160,9 +160,7 @@ static void dump(grib_accessor* a, grib_dumper* dumper) static int pack_double(grib_accessor* a, const double* val, size_t* len) { grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - char s[200] = { - 0, - }; + char s[200] = {0,}; sprintf(s, "%g", *val); self->key = grib_context_strdup(a->context, s); self->ha = 0; @@ -172,9 +170,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) static int pack_long(grib_accessor* a, const long* val, size_t* len) { grib_accessor_hash_array* self = (grib_accessor_hash_array*)a; - char s[200] = { - 0, - }; + char s[200] = {0,}; sprintf(s, "%ld", *val); if (self->key) grib_context_free(a->context, self->key); diff --git a/src/grib_accessor_class_ksec1expver.c b/src/grib_accessor_class_ksec1expver.c index 2362fac5a..c6c1f81ad 100644 --- a/src/grib_accessor_class_ksec1expver.c +++ b/src/grib_accessor_class_ksec1expver.c @@ -199,9 +199,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) static int pack_long(grib_accessor* a, const long* val, size_t* len) { - char sval[5] = { - 0, - }; + char sval[5] = {0,}; size_t slen = 4; sprintf(sval, "%04d", (int)(*val)); return pack_string(a, sval, &slen); diff --git a/src/grib_accessor_class_library_version.c b/src/grib_accessor_class_library_version.c index f34a67402..a2b0191e0 100644 --- a/src/grib_accessor_class_library_version.c +++ b/src/grib_accessor_class_library_version.c @@ -129,9 +129,7 @@ static void init_class(grib_accessor_class* c) static int unpack_string(grib_accessor* a, char* val, size_t* len) { - char result[30] = { - 0, - }; + char result[30] = {0,}; size_t size; int major = ECCODES_MAJOR_VERSION; diff --git a/src/grib_accessor_class_local_definition.c b/src/grib_accessor_class_local_definition.c index 460d07722..c66a99ba9 100644 --- a/src/grib_accessor_class_local_definition.c +++ b/src/grib_accessor_class_local_definition.c @@ -194,9 +194,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len) long aerosol = -1; long chemical_distfn = -1; long aerosol_optical = -1; - char stepType[15] = { - 0, - }; + char stepType[15] = {0,}; size_t slen = 15; int localDefinitionNumber = *val; int isInstant = 0; diff --git a/src/grib_accessor_class_lookup.c b/src/grib_accessor_class_lookup.c index 50adbe9eb..54643c513 100644 --- a/src/grib_accessor_class_lookup.c +++ b/src/grib_accessor_class_lookup.c @@ -161,12 +161,8 @@ static void post_init(grib_accessor* a) static void dump(grib_accessor* a, grib_dumper* dumper) { grib_accessor_lookup* self = (grib_accessor_lookup*)a; - unsigned char bytes[1024] = { - 0, - }; - char msg[1024] = { - 0, - }; + unsigned char bytes[1024] = {0,}; + char msg[1024] = {0,}; char buf[2048]; int i; unsigned long v = 0; @@ -191,9 +187,7 @@ static void dump(grib_accessor* a, grib_dumper* dumper) static int unpack_string(grib_accessor* a, char* v, size_t* len) { grib_accessor_lookup* self = (grib_accessor_lookup*)a; - unsigned char bytes[1024] = { - 0, - }; + unsigned char bytes[1024] = {0,}; int i; size_t llen = self->llength; diff --git a/src/grib_accessor_class_mars_step.c b/src/grib_accessor_class_mars_step.c index bb2c806d5..31ebcc0f1 100644 --- a/src/grib_accessor_class_mars_step.c +++ b/src/grib_accessor_class_mars_step.c @@ -147,9 +147,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len) { char stepType[100]; size_t stepTypeLen = 100; - char buf[100] = { - 0, - }; + char buf[100] = {0,}; int ret; grib_accessor_mars_step* self = (grib_accessor_mars_step*)a; grib_accessor* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(a), self->stepRange); @@ -174,9 +172,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) { int ret = 0; grib_accessor_mars_step* self = (grib_accessor_mars_step*)a; - char buf[100] = { - 0, - }; + char buf[100] = {0,}; char* p = NULL; size_t buflen = 100; long step; @@ -211,9 +207,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) static int pack_long(grib_accessor* a, const long* val, size_t* len) { - char buff[100] = { - 0, - }; + char buff[100] = {0,}; size_t bufflen = 100; sprintf(buff, "%ld", *val); diff --git a/src/grib_accessor_class_non_alpha.c b/src/grib_accessor_class_non_alpha.c index 804e09c70..182a55f12 100644 --- a/src/grib_accessor_class_non_alpha.c +++ b/src/grib_accessor_class_non_alpha.c @@ -213,9 +213,7 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len) static int unpack_long(grib_accessor* a, long* v, size_t* len) { - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); size_t i = 0; char* last = NULL; diff --git a/src/grib_accessor_class_number_of_points_gaussian.c b/src/grib_accessor_class_number_of_points_gaussian.c index 0482b78cd..eddd94f91 100644 --- a/src/grib_accessor_class_number_of_points_gaussian.c +++ b/src/grib_accessor_class_number_of_points_gaussian.c @@ -338,9 +338,7 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) int is_global = 0; long ni = 0, nj = 0, plpresent = 0, order = 0; size_t plsize = 0; - double* lats = { - 0, - }; + double* lats = {0,}; double lat_first, lat_last, lon_first, lon_last; long* pl = NULL; long* plsave = NULL; @@ -450,7 +448,6 @@ static int unpack_long_new(grib_accessor* a, long* val, size_t* len) return ret; } - /* With Legacy support */ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* len) { @@ -458,9 +455,7 @@ static int unpack_long_with_legacy_support(grib_accessor* a, long* val, size_t* int is_global = 0; long ni = 0, nj = 0, plpresent = 0, order = 0; size_t plsize = 0; - double* lats = { - 0, - }; + double* lats = {0,}; double lat_first, lat_last, lon_first, lon_last; long* pl = NULL; long* plsave = NULL; diff --git a/src/grib_accessor_class_sexagesimal2decimal.c b/src/grib_accessor_class_sexagesimal2decimal.c index 1c3e2533e..495822f0c 100644 --- a/src/grib_accessor_class_sexagesimal2decimal.c +++ b/src/grib_accessor_class_sexagesimal2decimal.c @@ -156,9 +156,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) { int err = 0; grib_accessor_sexagesimal2decimal* self = (grib_accessor_sexagesimal2decimal*)a; - char buff[512] = { - 0, - }; + char buff[512] = {0,}; size_t length = 0; size_t size = 512; char* p; @@ -265,7 +263,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) return GRIB_ARRAY_TOO_SMALL; } - strcpy(val, buff); len[0] = length; diff --git a/src/grib_accessor_class_smart_table.c b/src/grib_accessor_class_smart_table.c index bab20ea21..5addbdef8 100644 --- a/src/grib_accessor_class_smart_table.c +++ b/src/grib_accessor_class_smart_table.c @@ -221,35 +221,17 @@ static grib_smart_table* load_table(grib_accessor_smart_table* self) grib_smart_table* t = NULL; grib_smart_table* next = NULL; char* filename = 0; - char name[2048] = { - 0, - }; - char recomposed[1024] = { - 0, - }; - char localRecomposed[1024] = { - 0, - }; + char name[2048] = {0,}; + char recomposed[1024] = {0,}; + char localRecomposed[1024] = {0,}; char* localFilename = 0; - char extraRecomposed[1024] = { - 0, - }; + char extraRecomposed[1024] = {0,}; char* extraFilename = 0; - char localName[2048] = { - 0, - }; - char masterDir[1024] = { - 0, - }; - char localDir[1024] = { - 0, - }; - char extraDir[1024] = { - 0, - }; - char extraTable[2048] = { - 0, - }; + char localName[2048] = {0,}; + char masterDir[1024] = {0,}; + char localDir[1024] = {0,}; + char extraDir[1024] = {0,}; + char extraTable[2048] = {0,}; size_t len = 1024; if (self->masterDir != NULL) { @@ -325,9 +307,7 @@ static grib_smart_table* load_table(grib_accessor_smart_table* self) static int grib_load_smart_table(grib_context* c, const char* filename, const char* recomposed_name, size_t size, grib_smart_table* t) { - char line[1024] = { - 0, - }; + char line[1024] = {0,}; FILE* f = NULL; int lineNumber; int numberOfColumns; diff --git a/src/grib_accessor_class_smart_table_column.c b/src/grib_accessor_class_smart_table_column.c index b779f9386..436b75567 100644 --- a/src/grib_accessor_class_smart_table_column.c +++ b/src/grib_accessor_class_smart_table_column.c @@ -191,9 +191,7 @@ static int unpack_string_array(grib_accessor* a, char** buffer, size_t* len) size_t size = 1; long* code; int err = GRIB_SUCCESS; - char tmp[1024] = { - 0, - }; + char tmp[1024] = {0,}; int i = 0; tableAccessor = (grib_accessor_smart_table*)grib_find_accessor(grib_handle_of_accessor(a), self->smartTable); diff --git a/src/grib_accessor_class_to_double.c b/src/grib_accessor_class_to_double.c index 81ecbe1ad..0a0b36455 100644 --- a/src/grib_accessor_class_to_double.c +++ b/src/grib_accessor_class_to_double.c @@ -203,9 +203,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) { int err = 0; grib_accessor_to_double* self = (grib_accessor_to_double*)a; - char buff[512] = { - 0, - }; + char buff[512] = {0,}; size_t length; size_t size = 512; @@ -252,9 +250,7 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len) static int unpack_long(grib_accessor* a, long* v, size_t* len) { grib_accessor_to_double* self = (grib_accessor_to_double*)a; - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); char* last = NULL; int err = grib_unpack_string(a, val, &l); @@ -274,9 +270,7 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len) static int unpack_double(grib_accessor* a, double* v, size_t* len) { grib_accessor_to_double* self = (grib_accessor_to_double*)a; - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); char* last = NULL; int err = grib_unpack_string(a, val, &l); diff --git a/src/grib_accessor_class_to_integer.c b/src/grib_accessor_class_to_integer.c index e737e8663..867a82e7b 100644 --- a/src/grib_accessor_class_to_integer.c +++ b/src/grib_accessor_class_to_integer.c @@ -198,9 +198,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) { int err = 0; grib_accessor_to_integer* self = (grib_accessor_to_integer*)a; - char buff[512] = { - 0, - }; + char buff[512] = {0,}; size_t length; size_t size = 512; @@ -246,9 +244,7 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len) static int unpack_long(grib_accessor* a, long* v, size_t* len) { - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); char* last = NULL; int err = unpack_string(a, val, &l); diff --git a/src/grib_accessor_class_to_string.c b/src/grib_accessor_class_to_string.c index 9529007cb..1b840be17 100644 --- a/src/grib_accessor_class_to_string.c +++ b/src/grib_accessor_class_to_string.c @@ -198,9 +198,7 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len) { int err = 0; grib_accessor_to_string* self = (grib_accessor_to_string*)a; - char buff[512] = { - 0, - }; + char buff[512] = {0,}; size_t length; size_t size = 512; @@ -246,9 +244,7 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len) static int unpack_long(grib_accessor* a, long* v, size_t* len) { - char val[1024] = { - 0, - }; + char val[1024] = {0,}; size_t l = sizeof(val); char* last = NULL; int err = unpack_string(a, val, &l); diff --git a/src/grib_accessor_class_variable.c b/src/grib_accessor_class_variable.c index bb4519b56..f3f353d1c 100644 --- a/src/grib_accessor_class_variable.c +++ b/src/grib_accessor_class_variable.c @@ -418,9 +418,7 @@ static grib_accessor* make_clone(grib_accessor* a, grib_section* s, int* err) grib_accessor* the_clone = NULL; grib_accessor_variable* self = (grib_accessor_variable*)a; grib_accessor_variable* variableAccessor = NULL; - grib_action creator = { - 0, - }; + grib_action creator = {0,}; creator.op = "variable"; creator.name_space = ""; creator.set = 0; diff --git a/src/grib_bits_fast_big_endian.c b/src/grib_bits_fast_big_endian.c index 669ee3508..ce167c838 100644 --- a/src/grib_bits_fast_big_endian.c +++ b/src/grib_bits_fast_big_endian.c @@ -21,9 +21,7 @@ typedef struct bits_all_one_t long v[128]; } bits_all_one_t; -static bits_all_one_t bits_all_one = { 0, 0, { - 0, - } }; +static bits_all_one_t bits_all_one = { 0, 0, {0,} }; static void init_bits_all_one() { diff --git a/src/grib_concept_index.c b/src/grib_concept_index.c index 080841ec4..40dbd3a40 100644 --- a/src/grib_concept_index.c +++ b/src/grib_concept_index.c @@ -101,13 +101,9 @@ static int index_insert_entry(grib_concept_index* index, grib_concept_index_entr static void index_add_conditions(grib_concept_index* index, grib_concept_condition* condition) { grib_concept_condition* c = condition; - char s[512] = { - 0, - }; + char s[512] = {0,}; grib_concept_index_entry* e; - ; grib_concept_index_entry* entry = index_entry_new(index->context, index->keys); - ; while (c) { size_t size = 512; diff --git a/src/grib_dumper_class_bufr_encode_fortran.c b/src/grib_dumper_class_bufr_encode_fortran.c index 5279f1543..10f7c5902 100644 --- a/src/grib_dumper_class_bufr_encode_fortran.c +++ b/src/grib_dumper_class_bufr_encode_fortran.c @@ -207,9 +207,7 @@ static char* break_line(grib_context* c, const char* input) strcat(result, a_token); } else { - char tmp[256] = { - 0, - }; + char tmp[256] = {0,}; sprintf(tmp, "->&\n &%s", a_token); strcat(result, tmp); } diff --git a/src/grib_dumper_class_default.c b/src/grib_dumper_class_default.c index fb835b1ac..4030d503e 100644 --- a/src/grib_dumper_class_default.c +++ b/src/grib_dumper_class_default.c @@ -700,7 +700,6 @@ static void print_offset(FILE* out, grib_dumper* d, grib_accessor* a) grib_handle* h = grib_handle_of_accessor(a); theBegin = a->offset - self->section_offset + 1; - ; theEnd = grib_get_next_position_offset(a) - self->section_offset; if ((d->option_flags & GRIB_DUMP_FLAG_HEXADECIMAL) != 0 && a->length != 0) { diff --git a/src/grib_dumper_class_json.c b/src/grib_dumper_class_json.c index 5f3396b65..b20224441 100644 --- a/src/grib_dumper_class_json.c +++ b/src/grib_dumper_class_json.c @@ -442,9 +442,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_json* self = (grib_dumper_json*)d; - char value[MAX_STRING_SIZE] = { - 0, - }; /* See ECC-710 */ + char value[MAX_STRING_SIZE] = {0,}; /* See ECC-710 */ char* p = NULL; size_t size = MAX_STRING_SIZE; int is_missing = 0; diff --git a/src/grib_dumper_class_serialize.c b/src/grib_dumper_class_serialize.c index d5a85ea86..6964fc285 100644 --- a/src/grib_dumper_class_serialize.c +++ b/src/grib_dumper_class_serialize.c @@ -205,9 +205,7 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment) static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment) { grib_dumper_serialize* self = (grib_dumper_serialize*)d; - char value[1024] = { - 0, - }; + char value[1024] = {0,}; size_t size = sizeof(value); int err = grib_unpack_string(a, value, &size); int i; diff --git a/src/grib_expression_class_accessor.c b/src/grib_expression_class_accessor.c index 7e4ef3e9d..98b2f4d6f 100644 --- a/src/grib_expression_class_accessor.c +++ b/src/grib_expression_class_accessor.c @@ -114,9 +114,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* result) static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, size_t* size, int* err) { grib_expression_accessor* e = (grib_expression_accessor*)g; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; long start = e->start; Assert(buf); diff --git a/src/grib_expression_class_is_in_dict.c b/src/grib_expression_class_is_in_dict.c index 02c5caa9f..36427045a 100644 --- a/src/grib_expression_class_is_in_dict.c +++ b/src/grib_expression_class_is_in_dict.c @@ -95,12 +95,8 @@ static grib_trie* load_dictionary(grib_context* c, grib_expression* e, int* err) grib_expression_is_in_dict* self = (grib_expression_is_in_dict*)e; char* filename = NULL; - char line[1024] = { - 0, - }; - char key[1024] = { - 0, - }; + char line[1024] = {0,}; + char key[1024] = {0,}; char* list = 0; grib_trie* dictionary = NULL; FILE* f = NULL; @@ -153,7 +149,6 @@ static grib_trie* load_dictionary(grib_context* c, grib_expression* e, int* err) return dictionary; } - static const char* get_name(grib_expression* g) { grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g; @@ -164,9 +159,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result) { grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g; int err = 0; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; grib_trie* dict = load_dictionary(h->context, g, &err); @@ -186,9 +179,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* result) { grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g; int err = 0; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; grib_trie* list = load_dictionary(h->context, g, &err); @@ -207,9 +198,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* result) static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, size_t* size, int* err) { grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)g; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t sizebuf = 1024; long result; @@ -240,7 +229,6 @@ static void print(grib_context* c, grib_expression* g, grib_handle* f) printf("')"); } - grib_expression* new_is_in_dict_expression(grib_context* c, const char* name, const char* list) { grib_expression_is_in_dict* e = (grib_expression_is_in_dict*)grib_context_malloc_clear_persistent(c, sizeof(grib_expression_is_in_dict)); diff --git a/src/grib_expression_class_is_in_list.c b/src/grib_expression_class_is_in_list.c index b59f783ed..ab4a90e10 100644 --- a/src/grib_expression_class_is_in_list.c +++ b/src/grib_expression_class_is_in_list.c @@ -97,9 +97,7 @@ static grib_trie* load_list(grib_context* c, grib_expression* e, int* err) grib_expression_is_in_list* self = (grib_expression_is_in_list*)e; char* filename = NULL; - char line[1024] = { - 0, - }; + char line[1024] = {0,}; grib_trie* list = NULL; FILE* f = NULL; @@ -160,9 +158,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result) { grib_expression_is_in_list* e = (grib_expression_is_in_list*)g; int err = 0; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; grib_trie* list = load_list(h->context, g, &err); @@ -182,9 +178,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* result) { grib_expression_is_in_list* e = (grib_expression_is_in_list*)g; int err = 0; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; grib_trie* list = load_list(h->context, g, &err); @@ -203,9 +197,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* result) static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, size_t* size, int* err) { grib_expression_is_in_list* e = (grib_expression_is_in_list*)g; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t sizebuf = 1024; long result; diff --git a/src/grib_expression_class_is_integer.c b/src/grib_expression_class_is_integer.c index 6c18deb21..60e76e7ed 100644 --- a/src/grib_expression_class_is_integer.c +++ b/src/grib_expression_class_is_integer.c @@ -103,9 +103,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result) { grib_expression_is_integer* e = (grib_expression_is_integer*)g; int err = 0; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; char* p = 0; long val = 0; diff --git a/src/grib_expression_class_length.c b/src/grib_expression_class_length.c index ee03491dd..4de5b8c2b 100644 --- a/src/grib_expression_class_length.c +++ b/src/grib_expression_class_length.c @@ -103,9 +103,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result) { grib_expression_length* e = (grib_expression_length*)g; int err = 0; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; if ((err = grib_get_string_internal(h, e->name, mybuf, &size)) != GRIB_SUCCESS) return err; @@ -117,9 +115,7 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result) static int evaluate_double(grib_expression* g, grib_handle* h, double* result) { grib_expression_length* e = (grib_expression_length*)g; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; size_t size = 1024; int err = 0; if ((err = grib_get_string_internal(h, e->name, mybuf, &size)) != GRIB_SUCCESS) @@ -132,9 +128,7 @@ static int evaluate_double(grib_expression* g, grib_handle* h, double* result) static string evaluate_string(grib_expression* g, grib_handle* h, char* buf, size_t* size, int* err) { grib_expression_length* e = (grib_expression_length*)g; - char mybuf[1024] = { - 0, - }; + char mybuf[1024] = {0,}; Assert(buf); if ((*err = grib_get_string_internal(h, e->name, mybuf, size)) != GRIB_SUCCESS) return NULL; diff --git a/src/grib_expression_class_sub_string.c b/src/grib_expression_class_sub_string.c index f058ee244..60e0d03ab 100644 --- a/src/grib_expression_class_sub_string.c +++ b/src/grib_expression_class_sub_string.c @@ -102,18 +102,14 @@ static void destroy(grib_context* c, grib_expression* g) grib_context_free_persistent(c, e->value); } - static void add_dependency(grib_expression* g, grib_accessor* observer) { /* grib_expression_sub_string* e = (grib_expression_sub_string*)g; */ } - grib_expression* new_sub_string_expression(grib_context* c, const char* value, size_t start, size_t length) { - char v[1024] = { - 0, - }; + char v[1024] = {0,}; grib_expression_sub_string* e = (grib_expression_sub_string*)grib_context_malloc_clear_persistent(c, sizeof(grib_expression_sub_string)); /* if (start<0) start+=strlen(value); */ diff --git a/src/grib_index.c b/src/grib_index.c index f8abeec33..d2febf8db 100644 --- a/src/grib_index.c +++ b/src/grib_index.c @@ -1205,7 +1205,6 @@ int _codes_index_add_file(grib_index* index, const char* filename, int message_t field->file = file; index->count++; field->offset = h->offset; - ; err = grib_get_long(h, "totalLength", &length); if (err) @@ -1374,7 +1373,7 @@ int grib_index_add_file(grib_index* index, const char* filename) field=(grib_field*)grib_context_malloc_clear(c,sizeof(grib_field)); field->file=file; index->count++; - field->offset=h->offset;; + field->offset=h->offset; err=grib_get_long(h,"totalLength",&length); if (err) return err; diff --git a/src/grib_iterator_class_polar_stereographic.c b/src/grib_iterator_class_polar_stereographic.c index 68f781057..7f2b8876d 100644 --- a/src/grib_iterator_class_polar_stereographic.c +++ b/src/grib_iterator_class_polar_stereographic.c @@ -129,12 +129,8 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args) double ts; /* value of small t */ double height; /* height above ellipsoid */ double x0, y0, lonFirst, latFirst; - proj_data_t fwd_proj_data = { - 0, - }; - proj_data_t inv_proj_data = { - 0, - }; + proj_data_t fwd_proj_data = {0,}; + proj_data_t inv_proj_data = {0,}; grib_iterator_polar_stereographic* self = (grib_iterator_polar_stereographic*)iter; diff --git a/src/grib_jasper_encoding.c b/src/grib_jasper_encoding.c index 2951ec3ec..97e31534a 100644 --- a/src/grib_jasper_encoding.c +++ b/src/grib_jasper_encoding.c @@ -102,9 +102,7 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper) jas_image_t image = { 0 }; jas_stream_t* jpcstream = 0; jas_stream_t* istream = 0; - jas_image_cmpt_t cmpt = { - 0, - }; + jas_image_cmpt_t cmpt = {0,}; jas_image_cmpt_t* pcmpt = 0; image.tlx_ = 0; diff --git a/src/grib_nearest.c b/src/grib_nearest.c index 94d69c8b4..a26afc23c 100644 --- a/src/grib_nearest.c +++ b/src/grib_nearest.c @@ -157,22 +157,12 @@ int grib_nearest_find_multiple( int* pindexes = indexes; int idx = 0, ii = 0; double max, min; - double qdistances[4] = { - 0, - }; - double qoutlats[4] = { - 0, - }; - double qoutlons[4] = { - 0, - }; - double qvalues[4] = { - 0, - }; + double qdistances[4] = {0,}; + double qoutlats[4] = {0,}; + double qoutlons[4] = {0,}; + double qvalues[4] = {0,}; double* rvalues = NULL; - int qindexes[4] = { - 0, - }; + int qindexes[4] = {0,}; int ret = 0; long i = 0; size_t len = 4; diff --git a/src/grib_openjpeg_encoding.c b/src/grib_openjpeg_encoding.c index 994c45085..efae107d1 100644 --- a/src/grib_openjpeg_encoding.c +++ b/src/grib_openjpeg_encoding.c @@ -47,16 +47,10 @@ int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper) double decimal = helper->decimal; int* data; - opj_cparameters_t parameters = { - 0, - }; /* compression parameters */ - opj_event_mgr_t event_mgr = { - 0, - }; /* event manager */ + opj_cparameters_t parameters = {0,}; /* compression parameters */ + opj_event_mgr_t event_mgr = {0,}; /* event manager */ opj_image_t* image = NULL; - opj_image_cmptparm_t cmptparm = { - 0, - }; + opj_image_cmptparm_t cmptparm = {0,}; opj_cio_t* cio = NULL; opj_cinfo_t* cinfo = NULL; @@ -147,18 +141,12 @@ int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, do int* data; size_t count; - opj_dparameters_t parameters = { - 0, - }; /* decompression parameters */ + opj_dparameters_t parameters = {0,}; /* decompression parameters */ opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */ - opj_event_mgr_t event_mgr = { - 0, - }; /* event manager */ + opj_event_mgr_t event_mgr = {0,}; /* event manager */ opj_cio_t* cio = NULL; opj_image_t* image = NULL; - opj_image_comp_t comp = { - 0, - }; + opj_image_comp_t comp = {0,}; /* set decoding parameters to default values */ opj_set_default_decoder_parameters(¶meters); @@ -348,14 +336,10 @@ int grib_openjpeg_encode(grib_context* c, j2k_encode_helper* helper) double decimal = helper->decimal; int* data; - opj_cparameters_t parameters = { - 0, - }; /* compression parameters */ + opj_cparameters_t parameters = {0,}; /* compression parameters */ opj_codec_t* codec = NULL; opj_image_t* image = NULL; - opj_image_cmptparm_t cmptparm = { - 0, - }; + opj_image_cmptparm_t cmptparm = {0,}; opj_stream_t* stream = NULL; opj_memory_stream mstream; @@ -472,16 +456,12 @@ int grib_openjpeg_decode(grib_context* c, unsigned char* buf, size_t* buflen, do int* data; size_t count; - opj_dparameters_t parameters = { - 0, - }; /* decompression parameters */ + opj_dparameters_t parameters = {0,}; /* decompression parameters */ opj_stream_t* stream = NULL; opj_memory_stream mstream; opj_image_t* image = NULL; opj_codec_t* codec = NULL; - opj_image_comp_t comp = { - 0, - }; + opj_image_comp_t comp = {0,}; /* set decoding parameters to default values */ opj_set_default_decoder_parameters(¶meters); diff --git a/src/grib_parse_utils.c b/src/grib_parse_utils.c index 404d222bf..0b2e46701 100644 --- a/src/grib_parse_utils.c +++ b/src/grib_parse_utils.c @@ -77,15 +77,11 @@ static void init() int grib_recompose_name(grib_handle* h, grib_accessor* observer, const char* uname, char* fname, int fail) { grib_accessor* a; - char loc[1024] = { - 0, - }; + char loc[1024] = {0,}; int i = 0; int ret = 0; int mode = -1; - char val[1024] = { - 0, - }; + char val[1024] = {0,}; double dval = 0; long lval = 0; int type = GRIB_TYPE_STRING; @@ -185,9 +181,7 @@ int grib_accessor_print(grib_accessor* a, const char* name, int type, const char char* p = NULL; double* dval = 0; long* lval = 0; - char sbuf[1024] = { - 0, - }; + char sbuf[1024] = {0,}; size_t replen = 0; int ret = 0; char* myformat = NULL; @@ -329,9 +323,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha case GRIB_TYPE_STRING: myseparator = separator ? (char*)separator : default_separator; if (size == 1) { - char sbuf[1024] = { - 0, - }; + char sbuf[1024] = {0,}; len = sizeof(sbuf); ret = grib_unpack_string(al->accessor, sbuf, &len); if (grib_is_missing_string(al->accessor, (unsigned char*)sbuf, len)) { @@ -440,12 +432,8 @@ int grib_recompose_print(grib_handle* h, grib_accessor* observer, const char* un int type = -1; char* separator = NULL; int l; - char buff[10] = { - 0, - }; - char buff1[1024] = { - 0, - }; + char buff[10] = {0,}; + char buff1[1024] = {0,}; int maxcolsd = 8; int maxcols; long numcols = 0; diff --git a/src/grib_query.c b/src/grib_query.c index 4f61f316b..1fd736ecd 100644 --- a/src/grib_query.c +++ b/src/grib_query.c @@ -366,9 +366,7 @@ static int condition_true(grib_accessor* a, codes_condition* condition) static void search_from_accessors_list(grib_accessors_list* al, grib_accessors_list* end, const char* name, grib_accessors_list* result) { - char attribute_name[200] = { - 0, - }; + char attribute_name[200] = {0,}; grib_accessor* accessor_result = 0; char* accessor_name = grib_split_name_attribute(al->accessor->context, name, attribute_name); @@ -573,9 +571,7 @@ grib_accessor* grib_find_accessor(const grib_handle* h, const char* name) aret = _grib_find_accessor(h, name); /* ECC-144: Performance */ } else { - char attribute_name[512] = { - 0, - }; + char attribute_name[512] = {0,}; grib_accessor* a = NULL; char* accessor_name = grib_split_name_attribute(h->context, name, attribute_name); diff --git a/src/grib_vdarray.c b/src/grib_vdarray.c index fd7d914ba..e3c037401 100644 --- a/src/grib_vdarray.c +++ b/src/grib_vdarray.c @@ -20,9 +20,7 @@ void grib_vdarray_print(const char* title, const grib_vdarray* vdarray) { size_t i; - char text[100] = { - 0, - }; + char text[100] = {0,}; Assert(vdarray); printf("%s: vdarray.n=%lu\n", title, (unsigned long)vdarray->n); for (i = 0; i < vdarray->n; i++) {