-
Notifications
You must be signed in to change notification settings - Fork 316
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
Conversation
Tagging @ladyada |
src/NMEA_build.cpp
Outdated
(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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@ladyada could I get another review? Thanks. |
src/NMEA_build.cpp
Outdated
if (nmeaWithCRLF) { | ||
strcpy(nmeaWithCRLF, nmea); // Copy original string | ||
strcat(nmeaWithCRLF, "\r\n"); // Append \r\n | ||
return nmeaWithCRLF; // return pointer to finished product |
There was a problem hiding this comment.
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
I added the suggested fix, but didn't tag you again @ladyada. |
No description provided.