diff mbox series

[01/12] utils: fix compilation with C++98

Message ID 20200422003735.3891-1-rosenp@gmail.com (mailing list archive)
State New, archived
Headers show
Series [01/12] utils: fix compilation with C++98 | expand

Commit Message

Rosen Penev April 22, 2020, 12:37 a.m. UTC
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 utils/cec-compliance/cec-test.cpp | 4 ++--
 utils/rds-ctl/rds-ctl.cpp         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Hans Verkuil April 23, 2020, 8:19 a.m. UTC | #1
On 22/04/2020 02:37, Rosen Penev wrote:
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  utils/cec-compliance/cec-test.cpp | 4 ++--
>  utils/rds-ctl/rds-ctl.cpp         | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
> index 032ff5ad..cc07998a 100644
> --- a/utils/cec-compliance/cec-test.cpp
> +++ b/utils/cec-compliance/cec-test.cpp
> @@ -908,7 +908,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>  		cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>  		fail_on_test(!transmit_timeout(node, &msg));
>  		fail_on_test(timed_out_or_abort(&msg));
> -		info = {};
> +		memset(&info, 0, sizeof(info));
>  		cec_ops_tuner_device_status(&msg, &info);
>  		if (!memcmp(&info, &info_vec[0], sizeof(info)))
>  			break;
> @@ -935,7 +935,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>  		cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>  		fail_on_test(!transmit_timeout(node, &msg));
>  		fail_on_test(timed_out_or_abort(&msg));
> -		info = {};
> +		memset(&info, 0, sizeof(info));
>  		cec_ops_tuner_device_status(&msg, &info);
>  		if (memcmp(&info, &(*iter), sizeof(info))) {
>  			log_tuner_service(info);
> diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
> index 0511fe5d..0e497b2a 100644
> --- a/utils/rds-ctl/rds-ctl.cpp
> +++ b/utils/rds-ctl/rds-ctl.cpp
> @@ -918,7 +918,7 @@ static void get_options(const int fd, const int capabilities, struct v4l2_freque
>  				printf("\tFrequency range      : %.1f MHz - %.1f MHz\n",
>  					 vt.rangelow / 16.0, vt.rangehigh / 16.0);
>  			printf("\tSignal strength/AFC  : %ld%%/%d\n",
> -				std::lround(vt.signal / 655.35), vt.afc);
> +				lround(vt.signal / 655.25), vt.afc);

v4l2-ctl-tuner.cpp also uses std::lround, but that one isn't changed back.

Is rds-ctl.cpp perhaps just missing a header?

Regards,

	Hans

>  			printf("\tCurrent audio mode   : %s\n", audmode2s(vt.audmode));
>  			printf("\tAvailable subchannels: %s\n",
>  					rxsubchans2s(vt.rxsubchans).c_str());
>
Rosen Penev April 23, 2020, 8:30 a.m. UTC | #2
> On Apr 23, 2020, at 1:19 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> 
> On 22/04/2020 02:37, Rosen Penev wrote:
>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>> ---
>> utils/cec-compliance/cec-test.cpp | 4 ++--
>> utils/rds-ctl/rds-ctl.cpp         | 2 +-
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
>> index 032ff5ad..cc07998a 100644
>> --- a/utils/cec-compliance/cec-test.cpp
>> +++ b/utils/cec-compliance/cec-test.cpp
>> @@ -908,7 +908,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>>        cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>>        fail_on_test(!transmit_timeout(node, &msg));
>>        fail_on_test(timed_out_or_abort(&msg));
>> -        info = {};
>> +        memset(&info, 0, sizeof(info));
>>        cec_ops_tuner_device_status(&msg, &info);
>>        if (!memcmp(&info, &info_vec[0], sizeof(info)))
>>            break;
>> @@ -935,7 +935,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>>        cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>>        fail_on_test(!transmit_timeout(node, &msg));
>>        fail_on_test(timed_out_or_abort(&msg));
>> -        info = {};
>> +        memset(&info, 0, sizeof(info));
>>        cec_ops_tuner_device_status(&msg, &info);
>>        if (memcmp(&info, &(*iter), sizeof(info))) {
>>            log_tuner_service(info);
>> diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
>> index 0511fe5d..0e497b2a 100644
>> --- a/utils/rds-ctl/rds-ctl.cpp
>> +++ b/utils/rds-ctl/rds-ctl.cpp
>> @@ -918,7 +918,7 @@ static void get_options(const int fd, const int capabilities, struct v4l2_freque
>>                printf("\tFrequency range      : %.1f MHz - %.1f MHz\n",
>>                     vt.rangelow / 16.0, vt.rangehigh / 16.0);
>>            printf("\tSignal strength/AFC  : %ld%%/%d\n",
>> -                std::lround(vt.signal / 655.35), vt.afc);
>> +                lround(vt.signal / 655.25), vt.afc);
> 
> v4l2-ctl-tuner.cpp also uses std::lround, but that one isn't changed back.
> 
> Is rds-ctl.cpp perhaps just missing a header?
Nope. std::lround is C++11.
> 
> Regards,
> 
>    Hans
> 
>>            printf("\tCurrent audio mode   : %s\n", audmode2s(vt.audmode));
>>            printf("\tAvailable subchannels: %s\n",
>>                    rxsubchans2s(vt.rxsubchans).c_str());
>> 
>
Hans Verkuil April 23, 2020, 8:48 a.m. UTC | #3
On 23/04/2020 10:30, Rosen Penev wrote:
> 
> 
>> On Apr 23, 2020, at 1:19 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>>
>> On 22/04/2020 02:37, Rosen Penev wrote:
>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>> ---
>>> utils/cec-compliance/cec-test.cpp | 4 ++--
>>> utils/rds-ctl/rds-ctl.cpp         | 2 +-
>>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
>>> index 032ff5ad..cc07998a 100644
>>> --- a/utils/cec-compliance/cec-test.cpp
>>> +++ b/utils/cec-compliance/cec-test.cpp
>>> @@ -908,7 +908,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>>>        cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>>>        fail_on_test(!transmit_timeout(node, &msg));
>>>        fail_on_test(timed_out_or_abort(&msg));
>>> -        info = {};
>>> +        memset(&info, 0, sizeof(info));
>>>        cec_ops_tuner_device_status(&msg, &info);
>>>        if (!memcmp(&info, &info_vec[0], sizeof(info)))
>>>            break;
>>> @@ -935,7 +935,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>>>        cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>>>        fail_on_test(!transmit_timeout(node, &msg));
>>>        fail_on_test(timed_out_or_abort(&msg));
>>> -        info = {};
>>> +        memset(&info, 0, sizeof(info));
>>>        cec_ops_tuner_device_status(&msg, &info);
>>>        if (memcmp(&info, &(*iter), sizeof(info))) {
>>>            log_tuner_service(info);
>>> diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
>>> index 0511fe5d..0e497b2a 100644
>>> --- a/utils/rds-ctl/rds-ctl.cpp
>>> +++ b/utils/rds-ctl/rds-ctl.cpp
>>> @@ -918,7 +918,7 @@ static void get_options(const int fd, const int capabilities, struct v4l2_freque
>>>                printf("\tFrequency range      : %.1f MHz - %.1f MHz\n",
>>>                     vt.rangelow / 16.0, vt.rangehigh / 16.0);
>>>            printf("\tSignal strength/AFC  : %ld%%/%d\n",
>>> -                std::lround(vt.signal / 655.35), vt.afc);
>>> +                lround(vt.signal / 655.25), vt.afc);
>>
>> v4l2-ctl-tuner.cpp also uses std::lround, but that one isn't changed back.
>>
>> Is rds-ctl.cpp perhaps just missing a header?
> Nope. std::lround is C++11.

So, why isn't v4l2-ctl-tuner.cpp changed to lround as well?

Regards,

	Hans

>>
>> Regards,
>>
>>    Hans
>>
>>>            printf("\tCurrent audio mode   : %s\n", audmode2s(vt.audmode));
>>>            printf("\tAvailable subchannels: %s\n",
>>>                    rxsubchans2s(vt.rxsubchans).c_str());
>>>
>>
Rosen Penev April 23, 2020, 8:50 a.m. UTC | #4
> On Apr 23, 2020, at 1:48 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> 
> On 23/04/2020 10:30, Rosen Penev wrote:
>> 
>> 
>>>> On Apr 23, 2020, at 1:19 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>>> 
>>> On 22/04/2020 02:37, Rosen Penev wrote:
>>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>>> ---
>>>> utils/cec-compliance/cec-test.cpp | 4 ++--
>>>> utils/rds-ctl/rds-ctl.cpp         | 2 +-
>>>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>>> 
>>>> diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
>>>> index 032ff5ad..cc07998a 100644
>>>> --- a/utils/cec-compliance/cec-test.cpp
>>>> +++ b/utils/cec-compliance/cec-test.cpp
>>>> @@ -908,7 +908,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>>>>       cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>>>>       fail_on_test(!transmit_timeout(node, &msg));
>>>>       fail_on_test(timed_out_or_abort(&msg));
>>>> -        info = {};
>>>> +        memset(&info, 0, sizeof(info));
>>>>       cec_ops_tuner_device_status(&msg, &info);
>>>>       if (!memcmp(&info, &info_vec[0], sizeof(info)))
>>>>           break;
>>>> @@ -935,7 +935,7 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
>>>>       cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
>>>>       fail_on_test(!transmit_timeout(node, &msg));
>>>>       fail_on_test(timed_out_or_abort(&msg));
>>>> -        info = {};
>>>> +        memset(&info, 0, sizeof(info));
>>>>       cec_ops_tuner_device_status(&msg, &info);
>>>>       if (memcmp(&info, &(*iter), sizeof(info))) {
>>>>           log_tuner_service(info);
>>>> diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
>>>> index 0511fe5d..0e497b2a 100644
>>>> --- a/utils/rds-ctl/rds-ctl.cpp
>>>> +++ b/utils/rds-ctl/rds-ctl.cpp
>>>> @@ -918,7 +918,7 @@ static void get_options(const int fd, const int capabilities, struct v4l2_freque
>>>>               printf("\tFrequency range      : %.1f MHz - %.1f MHz\n",
>>>>                    vt.rangelow / 16.0, vt.rangehigh / 16.0);
>>>>           printf("\tSignal strength/AFC  : %ld%%/%d\n",
>>>> -                std::lround(vt.signal / 655.35), vt.afc);
>>>> +                lround(vt.signal / 655.25), vt.afc);
>>> 
>>> v4l2-ctl-tuner.cpp also uses std::lround, but that one isn't changed back.
>>> 
>>> Is rds-ctl.cpp perhaps just missing a header?
>> Nope. std::lround is C++11.
> 
> So, why isn't v4l2-ctl-tuner.cpp changed to lround as well?
Ugh I think it’s in some other local patch of mine. I’ll need to resend this one.
> 
> Regards,
> 
>    Hans
> 
>>> 
>>> Regards,
>>> 
>>>   Hans
>>> 
>>>>           printf("\tCurrent audio mode   : %s\n", audmode2s(vt.audmode));
>>>>           printf("\tAvailable subchannels: %s\n",
>>>>                   rxsubchans2s(vt.rxsubchans).c_str());
>>>> 
>>> 
>
diff mbox series

Patch

diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 032ff5ad..cc07998a 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -908,7 +908,7 @@  static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
 		cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
 		fail_on_test(!transmit_timeout(node, &msg));
 		fail_on_test(timed_out_or_abort(&msg));
-		info = {};
+		memset(&info, 0, sizeof(info));
 		cec_ops_tuner_device_status(&msg, &info);
 		if (!memcmp(&info, &info_vec[0], sizeof(info)))
 			break;
@@ -935,7 +935,7 @@  static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
 		cec_msg_give_tuner_device_status(&msg, true, CEC_OP_STATUS_REQ_ONCE);
 		fail_on_test(!transmit_timeout(node, &msg));
 		fail_on_test(timed_out_or_abort(&msg));
-		info = {};
+		memset(&info, 0, sizeof(info));
 		cec_ops_tuner_device_status(&msg, &info);
 		if (memcmp(&info, &(*iter), sizeof(info))) {
 			log_tuner_service(info);
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 0511fe5d..0e497b2a 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -918,7 +918,7 @@  static void get_options(const int fd, const int capabilities, struct v4l2_freque
 				printf("\tFrequency range      : %.1f MHz - %.1f MHz\n",
 					 vt.rangelow / 16.0, vt.rangehigh / 16.0);
 			printf("\tSignal strength/AFC  : %ld%%/%d\n",
-				std::lround(vt.signal / 655.35), vt.afc);
+				lround(vt.signal / 655.25), vt.afc);
 			printf("\tCurrent audio mode   : %s\n", audmode2s(vt.audmode));
 			printf("\tAvailable subchannels: %s\n",
 					rxsubchans2s(vt.rxsubchans).c_str());