Message ID | 20200422003735.3891-7-rosenp@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/12] utils: fix compilation with C++98 | expand |
On 22/04/2020 02:37, Rosen Penev wrote: > Found with -Wimplicit-float-conversion > > Signed-off-by: Rosen Penev <rosenp@gmail.com> > --- > utils/rds-ctl/rds-ctl.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp > index 0e497b2a..cc1d3bf7 100644 > --- a/utils/rds-ctl/rds-ctl.cpp > +++ b/utils/rds-ctl/rds-ctl.cpp > @@ -525,7 +525,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) > > if (statistics->block_cnt) > block_error_percentage = > - (static_cast<float>(statistics->block_error_cnt) / statistics->block_cnt) * 100.0; > + (static_cast<float>(statistics->block_error_cnt) / statistics->block_cnt) * 100.0f; > printf("block errors / group errors: %u (%3.2f%%) / %u \n", > statistics->block_error_cnt, > block_error_percentage, statistics->group_error_cnt); > @@ -534,7 +534,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) > > if (statistics->block_cnt) > block_corrected_percentage = ( > - static_cast<float>(statistics->block_corrected_cnt) / statistics->block_cnt) * 100.0; > + static_cast<float>(statistics->block_corrected_cnt) / statistics->block_cnt) * 100.0f; > printf("corrected blocks: %u (%3.2f%%)\n", > statistics->block_corrected_cnt, block_corrected_percentage); > for (int i = 0; i < 16; i++) > I think this patch can be removed once the type of block_error_percentage and block_corrected_percentage is changed to double, so I am skipping this patch. Regards, Hans
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp index 0e497b2a..cc1d3bf7 100644 --- a/utils/rds-ctl/rds-ctl.cpp +++ b/utils/rds-ctl/rds-ctl.cpp @@ -525,7 +525,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) if (statistics->block_cnt) block_error_percentage = - (static_cast<float>(statistics->block_error_cnt) / statistics->block_cnt) * 100.0; + (static_cast<float>(statistics->block_error_cnt) / statistics->block_cnt) * 100.0f; printf("block errors / group errors: %u (%3.2f%%) / %u \n", statistics->block_error_cnt, block_error_percentage, statistics->group_error_cnt); @@ -534,7 +534,7 @@ static void print_rds_statistics(const struct v4l2_rds_statistics *statistics) if (statistics->block_cnt) block_corrected_percentage = ( - static_cast<float>(statistics->block_corrected_cnt) / statistics->block_cnt) * 100.0; + static_cast<float>(statistics->block_corrected_cnt) / statistics->block_cnt) * 100.0f; printf("corrected blocks: %u (%3.2f%%)\n", statistics->block_corrected_cnt, block_corrected_percentage); for (int i = 0; i < 16; i++)
Found with -Wimplicit-float-conversion Signed-off-by: Rosen Penev <rosenp@gmail.com> --- utils/rds-ctl/rds-ctl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)