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

Fix compiler warnings #157

Merged
merged 10 commits into from Apr 16, 2024
Merged

Fix compiler warnings #157

merged 10 commits into from Apr 16, 2024

Conversation

makermelissa
Copy link
Contributor

No description provided.

@makermelissa makermelissa requested a review from a team March 27, 2024 20:20
@makermelissa
Copy link
Contributor Author

Tagging @ladyada

(char *)malloc(len + 3); // +2 for \r\n, +1 for null terminator
if (newStr) {
strcpy(newStr, nmea); // Copy original string
strcat(newStr, "\r\n"); // Append \r\n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newstr is never used after this and we return nmea so this code does not actually append \r\n to nmea?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll take another look at the code.

@makermelissa
Copy link
Contributor Author

@ladyada could I get another review? Thanks.

if (nmeaWithCRLF) {
strcpy(nmeaWithCRLF, nmea); // Copy original string
strcat(nmeaWithCRLF, "\r\n"); // Append \r\n
return nmeaWithCRLF; // return pointer to finished product
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to return the same buffer, so strcpy it back and free the temp buff

@makermelissa
Copy link
Contributor Author

I added the suggested fix, but didn't tag you again @ladyada.

@makermelissa makermelissa merged commit f7bff30 into adafruit:master Apr 16, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants