ECC-269: refactoring and eliminate compiler warnings

This commit is contained in:
Shahram Najm 2016-06-16 13:57:00 +01:00
parent 73248a3260
commit 74f0f63e5f
2 changed files with 16 additions and 23 deletions

View File

@ -832,16 +832,14 @@ subroutine codes_get_string_array ( gribid, key, value, status )
integer(kind=kindOfInt), intent(in) :: gribid
character(len=*), intent(in) :: key
character(len=*), dimension(:),allocatable,intent(inout) :: value
character :: cvalue(size(value)*len(value(0)))
integer(kind=kindOfInt),optional, intent(out) :: status
character :: cvalue(size(value)*len(value(0)))
integer(kind=kindOfInt) :: iret
integer(kind=kindOfInt) :: nb_values
integer(kind=kindOfInt) :: slen
integer(kind=kindOfInt) :: size_value
integer(kind=kindOfInt) :: i,s,j
if (allocated(value) .eqv. .false.) then
iret=CODES_NULL_POINTER
if (present(status)) then
@ -855,11 +853,7 @@ subroutine codes_get_string_array ( gribid, key, value, status )
slen=len(value(0))
iret=grib_f_get_string_array ( gribid, key, cvalue , nb_values, slen )
value=transfer(cvalue,value)
if (iret==0 .and. nb_values==1 .and. size_value/=1) then
do i=2,size_value
value(i)=value(1)
enddo
endif
if (iret /= 0) then
call grib_f_write_on_fail(gribid)
endif

View File

@ -162,7 +162,7 @@ static void czstr_to_fortran(char* str,int len)
*p=' ';
}
static void czstr_to_fortran_replace0(char* str,int len)
/*static void czstr_to_fortran_replace0(char* str,int len)
{
char *p,*end;
p=str; end=str+len-1;
@ -170,7 +170,7 @@ static void czstr_to_fortran_replace0(char* str,int len)
if (*p=='\0') *p=' ';
p++;
}
}
}*/
static void fort_char_clean(char* str,int len)
{
@ -2708,8 +2708,8 @@ int grib_f_set_real8_array(int* gid, char* key, double *val, int* size, int len)
}
/*****************************************************************************/
int grib_f_get_string_array_(int* gid, char* key, unsigned char* val,int* nvals,int* slen,int len,int len2){
int grib_f_get_string_array_(int* gid, char* key, char* val,int* nvals,int* slen,int len,int len2)
{
grib_handle *h = get_handle(*gid);
int err = GRIB_SUCCESS;
size_t i;
@ -2720,7 +2720,6 @@ int grib_f_get_string_array_(int* gid, char* key, unsigned char* val,int* nvals,
if(!h) return GRIB_INVALID_GRIB;
cval=(char**)grib_context_malloc_clear(h->context,sizeof(char*)*lsize);
err = grib_get_string_array(h, cast_char(buf,key,len), cval, &lsize);
if (err) return err;
@ -2738,10 +2737,10 @@ int grib_f_get_string_array_(int* gid, char* key, unsigned char* val,int* nvals,
return err;
}
int grib_f_get_string_array__(int* gid, char* key, unsigned char* val,int* nvals,int* slen, int len,int len2){
int grib_f_get_string_array__(int* gid, char* key, char* val,int* nvals,int* slen, int len,int len2){
return grib_f_get_string_array_( gid, key, val,nvals,slen,len,len2);
}
int grib_f_get_string_array(int* gid, char* key, unsigned char* val,int* nvals,int* slen, int len,int len2){
int grib_f_get_string_array(int* gid, char* key, char* val,int* nvals,int* slen, int len,int len2){
return grib_f_get_string_array_( gid, key, val, nvals, slen, len,len2);
}