-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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 more Codacy warnings #3975
Fix more Codacy warnings #3975
Conversation
lib/ftp.c
Outdated
/* We've sent the TYPE, now we must send the list of prequote strings */ | ||
|
||
result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE); | ||
CURLcode result = ftp_state_quote(conn, TRUE, FTP_RETR_PREQUOTE); |
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.
This could even do a return
straight away without storing the return code in a variable...
lib/ftp.c
Outdated
/* We've sent the TYPE, now we must send the list of prequote strings */ | ||
|
||
result = ftp_state_quote(conn, TRUE, FTP_STOR_PREQUOTE); | ||
CURLcode result = ftp_state_quote(conn, TRUE, FTP_STOR_PREQUOTE); |
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.
this too
packages/OS400/os400sys.c
Outdated
char * enodename; | ||
char * eservname; | ||
char * enodename = (char *)NULL; | ||
char * eservname = (char *)NULL; |
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.
this could also fix the code style: make it char *ennodename
(without the extra space after the asterisk)
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.
Is this (char *)
cast required for Codacy as we have char *variable = NULL
elsewhere?
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.
@captain-caveman2k No it's not, I just moved the whole expression from below. I'll remove the cast.
Reduce variable scopes and remove redundant variable stores. Closes curl#3975
As want is size_t, (file->buffer_pos - want) is unsigned, so checking if it's less than zero makes no sense. Check if file->buffer_pos is less than want instead to avoid the unsigned integer wraparound. Closes curl#3975
Compilers and static analyzers warn about using C-style casts here. Closes curl#3975
Reduce variable scopes and remove redundant variable stores. Closes curl#3975
As want is size_t, (file->buffer_pos - want) is unsigned, so checking if it's less than zero makes no sense. Check if file->buffer_pos is less than want instead to avoid the unsigned integer wraparound. Closes curl#3975
Compilers and static analyzers warn about using C-style casts here. Closes curl#3975
This brings the "code style" C warnings in Codacy down to 57, most of which are either false positives or dead stores with the variable overriden after being initialized to a default value.
I'm not going to merge this before the 7.65.1 release. Just opening the PR because I had already forgotten about that branch.