Skip to content

Commit

Permalink
Fixed some -Wdouble-promotion warnings with casts
Browse files Browse the repository at this point in the history
  • Loading branch information
seanm committed Jan 30, 2016
1 parent e778c44 commit 458997c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions libsrc2/hyper.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ static int mirw_hyperslab_raw(int opcode,
for(_j=0;_j<image_slice_length;_j++)\
{\
double _temp;\
_temp=*_buffer;\
_temp= _temp*_scale + _offset ; \
*_buffer =(type_in)(_temp); \
_temp=(double)*_buffer;\
_temp=_temp*_scale + _offset ; \
*_buffer=(type_in)(_temp); \
_buffer++;\
}\
}\
Expand Down Expand Up @@ -801,7 +801,7 @@ static int mirw_hyperslab_icv(int opcode,
hsize_t _i,_j;\
double voxel_offset=voxel_min;\
double voxel_range=voxel_max-voxel_min;\
double norm_offset=norm_min;\
double norm_offset=(double)norm_min;\
double norm_range=(double)norm_max-(double)norm_min;\
double data_offset=data_min;\
double data_range=(double)data_max-(double)data_min;\
Expand Down
38 changes: 19 additions & 19 deletions libsrc2/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -1596,32 +1596,32 @@ void miinit_default_range(mitype_t mitype, double *valid_max, double *valid_min)
{
switch (mitype) {
case MI_TYPE_BYTE:
*valid_min = CHAR_MIN;
*valid_max = CHAR_MAX;
*valid_min = (double)CHAR_MIN;
*valid_max = (double)CHAR_MAX;
break;
case MI_TYPE_SHORT:
*valid_min = SHRT_MIN;
*valid_max = SHRT_MAX;
*valid_min = (double)SHRT_MIN;
*valid_max = (double)SHRT_MAX;
break;
case MI_TYPE_INT:
*valid_min = INT_MIN;
*valid_max = INT_MAX;
*valid_min = (double)INT_MIN;
*valid_max = (double)INT_MAX;
break;
case MI_TYPE_UBYTE:
*valid_min = 0;
*valid_max = UCHAR_MAX;
*valid_min = 0.0;
*valid_max = (double)UCHAR_MAX;
break;
case MI_TYPE_USHORT:
*valid_min = 0;
*valid_max = USHRT_MAX;
*valid_min = 0.0;
*valid_max = (double)USHRT_MAX;
break;
case MI_TYPE_UINT:
*valid_min = 0;
*valid_max = UINT_MAX;
*valid_min = 0.0;
*valid_max = (double)UINT_MAX;
break;
case MI_TYPE_FLOAT:
*valid_min = -FLT_MAX;
*valid_max = FLT_MAX;
*valid_min = (double)-FLT_MAX;
*valid_max = (double)FLT_MAX;
break;
case MI_TYPE_DOUBLE:
*valid_min = -DBL_MAX;
Expand All @@ -1632,12 +1632,12 @@ void miinit_default_range(mitype_t mitype, double *valid_max, double *valid_min)
*valid_max = DBL_MAX;
break;
case MI_TYPE_FCOMPLEX:
*valid_min = -FLT_MAX;
*valid_max = FLT_MAX;
break;
*valid_min = (double)-FLT_MAX;
*valid_max = (double)FLT_MAX;
break;
default:
*valid_min = 0;
*valid_max = 1;
*valid_min = 0.0;
*valid_max = 1.0;
MI_LOG_ERROR(MI2_MSG_BADTYPE,mitype);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion volume_io/Prog_utils/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ VIOAPI VIO_Status output_float(
{
VIO_Status status;

if( fprintf( file, " %g", f ) > 0 )
if( fprintf( file, " %g", (double)f ) > 0 )
status = VIO_OK;
else
{
Expand Down

0 comments on commit 458997c

Please sign in to comment.