Dead code removal

This commit is contained in:
shahramn 2024-10-08 17:25:30 +01:00
parent 0552739f15
commit c971122fcc
11 changed files with 61 additions and 186 deletions

View File

@ -57,25 +57,13 @@ void grib_accessor_bufr_elements_table_t::init(const long len, grib_arguments* p
grib_trie* grib_accessor_bufr_elements_table_t::load_bufr_elements_table(int* err)
{
char* filename = NULL;
char line[1024] = {
0,
};
char masterDir[1024] = {
0,
};
char localDir[1024] = {
0,
};
char dictName[1024] = {
0,
};
char masterRecomposed[1024] = {
0,
}; // e.g. bufr/tables/0/wmo/36/element.table
char localRecomposed[1024] = {
0,
}; // e.g. bufr/tables/0/local/0/98/0/element.table
char* filename = NULL;
char line[1024] = {0,};
char masterDir[1024] = {0,};
char localDir[1024] = {0,};
char dictName[1024] = {0,};
char masterRecomposed[1024] = {0,}; // e.g. bufr/tables/0/wmo/36/element.table
char localRecomposed[1024] = {0,}; // e.g. bufr/tables/0/local/0/98/0/element.table
char* localFilename = 0;
char** list = 0;
char** cached_list = 0;
@ -98,9 +86,7 @@ grib_trie* grib_accessor_bufr_elements_table_t::load_bufr_elements_table(int* er
GRIB_MUTEX_LOCK(&mutex1);
if (*masterDir != 0) {
char name[4096] = {
0,
};
char name[4096] = {0,};
snprintf(name, 4096, "%s/%s", masterDir, dictionary_);
grib_recompose_name(h, NULL, name, masterRecomposed, 0);
filename = grib_context_full_defs_path(c, masterRecomposed);
@ -110,9 +96,7 @@ grib_trie* grib_accessor_bufr_elements_table_t::load_bufr_elements_table(int* er
}
if (*localDir != 0) {
char localName[2048] = {
0,
};
char localName[2048] = {0,};
snprintf(localName, 2048, "%s/%s", localDir, dictionary_);
grib_recompose_name(h, NULL, localName, localRecomposed, 0);
localFilename = grib_context_full_defs_path(c, localRecomposed);

View File

@ -172,19 +172,11 @@ grib_codetable* grib_accessor_codetable_t::load_table()
grib_codetable* t = NULL;
grib_codetable* next = NULL;
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 (masterDir_ != NULL)
@ -195,9 +187,7 @@ grib_codetable* grib_accessor_codetable_t::load_table()
grib_get_string(h, localDir_, localDir, &len);
if (*masterDir != 0) {
char name[2048] = {
0,
};
char name[2048] = {0,};
snprintf(name, sizeof(name), "%s/%s", masterDir, tablename_);
grib_recompose_name(h, NULL, name, recomposed, 0);
filename = grib_context_full_defs_path(c, recomposed);
@ -208,9 +198,7 @@ grib_codetable* grib_accessor_codetable_t::load_table()
}
if (*localDir != 0) {
char localName[2048] = {
0,
};
char localName[2048] = {0,};
snprintf(localName, sizeof(localName), "%s/%s", localDir, tablename_);
grib_recompose_name(h, NULL, localName, localRecomposed, 0);
localFilename = grib_context_full_defs_path(c, localRecomposed);
@ -305,12 +293,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* pAbbrev = abbreviation;
char* pTitle = title;
char* units = 0;
@ -699,9 +683,7 @@ int grib_accessor_codetable_t::pack_string(const char* buffer, size_t* len)
long l = 0;
int ret = 0;
double d = 0;
char tmp[1024] = {
0,
};
char tmp[1024] = {0,};
grib_expression* expression = grib_arguments_get_expression(grib_handle_of_accessor(this), act->default_value, 0);
int type = grib_expression_native_type(grib_handle_of_accessor(this), expression);
switch (type) {

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -32,21 +31,11 @@ void grib_accessor_dictionary_t::init(const long len, grib_arguments* params)
grib_trie* grib_accessor_dictionary_t::load_dictionary(int* err)
{
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;
@ -66,12 +55,8 @@ grib_trie* grib_accessor_dictionary_t::load_dictionary(int* err)
grib_get_string(h, localDir_, localDir, &len);
if (*masterDir != 0) {
char name[2048] = {
0,
};
char recomposed[2048] = {
0,
};
char name[2048] = {0,};
char recomposed[2048] = {0,};
snprintf(name, sizeof(name), "%s/%s", masterDir, dictionary_);
grib_recompose_name(h, NULL, name, recomposed, 0);
filename = grib_context_full_defs_path(c, recomposed);
@ -81,12 +66,8 @@ grib_trie* grib_accessor_dictionary_t::load_dictionary(int* err)
}
if (*localDir != 0) {
char localName[2048] = {
0,
};
char localRecomposed[1024] = {
0,
};
char localName[2048] = {0,};
char localRecomposed[1024] = {0,};
snprintf(localName, sizeof(localName), "%s/%s", localDir, dictionary_);
grib_recompose_name(h, NULL, localName, localRecomposed, 0);
localFilename = grib_context_full_defs_path(c, localRecomposed);
@ -180,9 +161,7 @@ void grib_accessor_dictionary_t::dump(grib_dumper* dumper)
int grib_accessor_dictionary_t::unpack_string(char* buffer, size_t* len)
{
int err = GRIB_SUCCESS;
char key[1024] = {
0,
};
char key[1024] = {0,};
size_t size = 1024;
char* list = NULL;
char* start = NULL;
@ -252,9 +231,7 @@ long grib_accessor_dictionary_t::get_native_type()
int grib_accessor_dictionary_t::unpack_long(long* val, size_t* len)
{
int err = 0;
char buffer[1024] = {
0,
};
char buffer[1024] = {0,};
size_t size = 1024;
err = unpack_string(buffer, &size);
@ -270,9 +247,7 @@ int grib_accessor_dictionary_t::unpack_long(long* val, size_t* len)
int grib_accessor_dictionary_t::unpack_double(double* val, size_t* len)
{
int err = 0;
char buffer[1024] = {
0,
};
char buffer[1024] = {0,};
size_t size = 1024;
err = unpack_string(buffer, &size);

View File

@ -88,9 +88,7 @@ int grib_accessor_g1step_range_t::grib_g1_step_get_steps(long* start, long* theE
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;
@ -189,9 +187,7 @@ int grib_accessor_g1step_range_t::unpack_string(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(this);
@ -343,9 +339,7 @@ int grib_accessor_g1step_range_t::pack_string(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 (stepType_) {
@ -534,9 +528,7 @@ int grib_accessor_g1step_range_t::pack_long(const long* val, size_t* len)
char sval[100] = { 0 };
char* p = sval;
size_t svallen = 100;
char stepType[20] = {
0,
};
char stepType[20] = {0,};
size_t stepTypeLen = 20;
long step_unit = 0;
int err = 0;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -55,12 +54,8 @@ void grib_accessor_g2end_step_t::dump(grib_dumper* dumper)
bool is_special_expver(const grib_handle* h)
{
int ret = 0;
char strMarsExpVer[50] = {
0,
};
char strMarsClass[50] = {
0,
};
char strMarsExpVer[50] = {0,};
char strMarsClass[50] = {0,};
size_t slen = 50;
ret = grib_get_string(h, "mars.class", strMarsClass, &slen);
if (ret == GRIB_SUCCESS && STR_EQUAL(strMarsClass, "em")) {

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -45,9 +44,7 @@ int grib_accessor_g2level_t::unpack_double(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;
bool tigge = is_tigge(hand);
@ -134,9 +131,7 @@ int grib_accessor_g2level_t::pack_double(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;
const long lval = (long)value_first;
@ -197,9 +192,7 @@ int grib_accessor_g2level_t::pack_long(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_handle* hand = grib_handle_of_accessor(this);

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -37,9 +36,7 @@ long grib_accessor_gaussian_grid_name_t::get_native_type()
int grib_accessor_gaussian_grid_name_t::unpack_string(char* v, size_t* len)
{
long N = 0, Ni = 0;
char tmp[MAX_GRIDNAME_LEN] = {
0,
};
char tmp[MAX_GRIDNAME_LEN] = {0,};
size_t length = 0;
int ret = GRIB_SUCCESS;

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -26,9 +25,7 @@ int grib_accessor_mars_step_t::pack_string(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* stepRangeAcc = grib_find_accessor(grib_handle_of_accessor(this), stepRange_);
@ -51,9 +48,7 @@ int grib_accessor_mars_step_t::pack_string(const char* val, size_t* len)
int grib_accessor_mars_step_t::unpack_string(char* val, size_t* len)
{
int ret = 0;
char buf[100] = {
0,
};
char buf[100] = {0,};
char* p = NULL;
size_t buflen = 100;
long step;
@ -89,9 +84,7 @@ int grib_accessor_mars_step_t::unpack_string(char* val, size_t* len)
int grib_accessor_mars_step_t::pack_long(const long* val, size_t* len)
{
char buff[100] = {
0,
};
char buff[100] = {0,};
size_t bufflen = 100;
snprintf(buff, sizeof(buff), "%ld", *val);

View File

@ -103,9 +103,7 @@ static int proj_equatorial_azimuthal_equidistant(grib_handle* h, char* result)
static int proj_lambert_conformal(grib_handle* h, char* result)
{
int err = 0;
char shape[128] = {
0,
};
char shape[128] = {0,};
double LoVInDegrees = 0, LaDInDegrees = 0, Latin1InDegrees = 0, Latin2InDegrees = 0;
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
@ -126,9 +124,7 @@ static int proj_lambert_conformal(grib_handle* h, char* result)
static int proj_lambert_azimuthal_equal_area(grib_handle* h, char* result)
{
int err = 0;
char shape[128] = {
0,
};
char shape[128] = {0,};
double standardParallel = 0, centralLongitude = 0;
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
@ -148,9 +144,7 @@ static int proj_polar_stereographic(grib_handle* h, char* result)
double centralLongitude = 0, centralLatitude = 0;
int has_northPole = 0;
long projectionCentreFlag = 0;
char shape[128] = {
0,
};
char shape[128] = {0,};
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
return err;
@ -183,9 +177,7 @@ static int proj_mercator(grib_handle* h, char* result)
{
int err = 0;
double LaDInDegrees = 0;
char shape[128] = {
0,
};
char shape[128] = {0,};
if ((err = grib_get_double_internal(h, "LaDInDegrees", &LaDInDegrees)) != GRIB_SUCCESS)
return err;
@ -218,9 +210,7 @@ int grib_accessor_proj_string_t::unpack_string(char* v, size_t* len)
{
int err = 0, found = 0;
size_t i = 0;
char grid_type[64] = {
0,
};
char grid_type[64] = {0,};
grib_handle* h = grib_handle_of_accessor(this);
size_t size = sizeof(grid_type) / sizeof(*grid_type);

View File

@ -73,26 +73,14 @@ grib_smart_table* grib_accessor_smart_table_t::load_table()
grib_smart_table* t = NULL;
grib_smart_table* next = NULL;
char* filename = 0;
char recomposed[1024] = {
0,
};
char localRecomposed[1024] = {
0,
};
char recomposed[1024] = {0,};
char localRecomposed[1024] = {0,};
char* localFilename = 0;
char extraRecomposed[1024] = {
0,
};
char extraRecomposed[1024] = {0,};
char* extraFilename = 0;
char masterDir[1024] = {
0,
};
char localDir[1024] = {
0,
};
char extraDir[1024] = {
0,
};
char masterDir[1024] = {0,};
char localDir[1024] = {0,};
char extraDir[1024] = {0,};
size_t len = 1024;
if (masterDir_ != NULL) {
@ -110,9 +98,7 @@ grib_smart_table* grib_accessor_smart_table_t::load_table()
}
if (*masterDir != 0) {
char name[2048] = {
0,
};
char name[2048] = {0,};
snprintf(name, sizeof(name), "%s/%s", masterDir, tablename_);
grib_recompose_name(h, NULL, name, recomposed, 0);
filename = grib_context_full_defs_path(c, recomposed);
@ -123,18 +109,14 @@ grib_smart_table* grib_accessor_smart_table_t::load_table()
}
if (*localDir != 0) {
char localName[2048] = {
0,
};
char localName[2048] = {0,};
snprintf(localName, sizeof(localName), "%s/%s", localDir, tablename_);
grib_recompose_name(h, NULL, localName, localRecomposed, 0);
localFilename = grib_context_full_defs_path(c, localRecomposed);
}
if (*extraDir != 0) {
char extraTable[2048] = {
0,
};
char extraTable[2048] = {0,};
snprintf(extraTable, sizeof(extraTable), "%s/%s", extraDir, extraTable_);
grib_recompose_name(h, NULL, extraTable, extraRecomposed, 0);
extraFilename = grib_context_full_defs_path(c, extraRecomposed);
@ -180,9 +162,7 @@ grib_smart_table* grib_accessor_smart_table_t::load_table()
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, code;

View File

@ -30,9 +30,7 @@ int grib_accessor_trim_t::unpack_string(char* val, size_t* len)
{
int err = 0;
grib_handle* h = grib_handle_of_accessor(this);
char input[256] = {
0,
};
char input[256] = {0,};
size_t size = sizeof(input) / sizeof(*input);
char* pInput = input;
@ -48,14 +46,10 @@ int grib_accessor_trim_t::unpack_string(char* val, size_t* len)
int grib_accessor_trim_t::pack_string(const char* val, size_t* len)
{
char input[256] = {
0,
};
char input[256] = {0,};
size_t inputLen = 256;
char buf[256] = {
0,
};
char buf[256] = {0,};
char* pBuf = NULL;
int err;
grib_handle* h = grib_handle_of_accessor(this);