Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent return value semantics in RTCM3 decoding functions #754

Open
Cyfarw9dd opened this issue Sep 6, 2024 · 2 comments
Open

Inconsistent return value semantics in RTCM3 decoding functions #754

Cyfarw9dd opened this issue Sep 6, 2024 · 2 comments

Comments

@Cyfarw9dd
Copy link

RTKLIB version: 2.4.2 p13

Using Language: C

Hello, I've identified a potential issue in the RTCM3 decoding functions that may lead to misunderstandings and unexpected behavior. The problem lies in the inconsistent return value semantics between decode_msm7 and other functions like input_rtcm3 and input_rtcm3f.

Problem:

  1. In decode_msm7, a successful decoding (when sync is true) returns 0:
return sync ? 0 : 1;
  1. However, in input_rtcm3f, the function expects a non-zero return value to indicate successful decoding:
if ((ret=input_rtcm3(rtcm,(unsigned char)data))) return ret;
  1. This inconsistency means that even when decode_msm7 successfully decodes a message, input_rtcm3f continues processing instead of returning immediately.

  2. Additionally, input_rtcm3 also returns 0 in various error cases(like the checksum), further complicating the issue.

Proposed Solution: Modify the return value of decode_msm7 from sync ? 0 : 1 to sync ? 1 : 0. This change would use 1 as the success code, aligning with the expected behavior in input_rtcm3f.

I've tested this change with messages 1077, 1097, and 1127, and it works well.

This modification would improve code consistency and prevent potential misunderstandings or bugs in the decoding process.

Would you agree with this change? If so, I can prepare a pull request with the necessary modifications.

@yydgis
Copy link

yydgis commented Sep 6, 2024 via email

@Cyfarw9dd
Copy link
Author

Thank you for your detailed response. It appears I did indeed misunderstand the meaning of 'sync'. Your explanation has been very helpful in clarifying this concept. I appreciate your time and assistance in addressing this issue.

Best regards,
JianTao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants