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

Correct ato* clang warnings #429

Merged
merged 2 commits into from
Nov 2, 2017
Merged

Correct ato* clang warnings #429

merged 2 commits into from
Nov 2, 2017

Conversation

benrubson
Copy link
Contributor

Hi,

This PR helps with #427, it solves clang warnings regarding ato* functions.

Thank you 👍

Ben

@benrubson benrubson requested a review from vgough October 20, 2017 16:49
@@ -644,7 +644,7 @@ static Cipher::CipherAlgorithm selectCipherAlgorithm() {
cout << "\n" << _("Enter the number corresponding to your choice: ");
char answer[10];
char *res = fgets(answer, sizeof(answer), stdin);
int cipherNum = (res == nullptr ? 0 : atoi(answer));
int cipherNum = (res == nullptr ? 0 : (int)strtol(answer, nullptr, 10));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, where is the improvement here? Still no check if we got a valid number.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx for your review !
Goal is at least to remove warnings.
There is a check just after strtol(), so it's OK.
In XmlReader.cpp, I've added checks which were not done before.
Thx !

@benrubson benrubson merged commit 4e19edf into vgough:master Nov 2, 2017
@benrubson benrubson deleted the clang1 branch November 2, 2017 07:44
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.

2 participants