Applied clang-format (Part 2)

This commit is contained in:
Shahram Najm 2020-01-22 14:48:06 +00:00
parent 7d3619d493
commit 3d188bebbf
60 changed files with 145 additions and 452 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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++)

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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);*/
}

View File

@ -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 };

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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()
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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); */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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(&parameters);
@ -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(&parameters);

View File

@ -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;

View File

@ -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);

View File

@ -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++) {