Closed Bug 1171016 Opened 4 years ago Closed 4 years ago

ParseFTPList.cpp: Value stored to 'linelen' is never read

Categories

(Core :: Networking: FTP, defect)

40 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: Sylvestre, Assigned: sanchitkum, Mentored)

Details

(Keywords: clang-analyzer, Whiteboard: [good first bug][lang=C++])

Attachments

(1 file, 1 obsolete file)

I'd like to work in this.

It looks like it has been put there as a variable initialization, which happens anyway at https://dxr.mozilla.org/mozilla-central/source/netwerk/streamconv/converters/ParseFTPList.cpp?from=ParseFTPList.cpp#50

Should we romove it?
yes (as the title of this bug suggests ;)
If no one is working on it. Should i go ahead and submit a patch? :)
Flags: needinfo?(sledru)
Piervincenzo seems to work on this. If he/she didn't proposed a patch in a few days, you are welcome to take it.
Flags: needinfo?(sledru)
Okay. :)
Initialized the variable 'linelen' at its declaration.
Attachment #8617868 - Flags: review?(sledru)
Comment on attachment 8617868 [details] [diff] [review]
bug1171016_initializationAtDeclaration.diff

lgtm but I am not the owner of this code.
Attachment #8617868 - Flags: review?(sledru)
Assignee: nobody → sanchitkum
Okay.
Attachment #8617868 - Flags: review?(mcmanus)
Comment on attachment 8617868 [details] [diff] [review]
bug1171016_initializationAtDeclaration.diff

Review of attachment 8617868 [details] [diff] [review]:
-----------------------------------------------------------------

thanks!

::: netwerk/streamconv/converters/ParseFTPList.cpp
@@ -23,5 @@
>  int ParseFTPList(const char *line, struct list_state *state,
>                   struct list_result *result )
>  {
>    unsigned int carry_buf_len; /* copy of state->carry_buf_len */
> -  unsigned int linelen, pos;

I would rather fix this by declaring the variable where it is first meaningfully used.

remove lineline from this declaration

@@ -36,5 @@
>    /* carry buffer is only valid from one line to the next */
>    carry_buf_len = state->carry_buf_len;
>    state->carry_buf_len = 0;
>  
> -  linelen = 0;

remove this too (as you did)

and then down below where we have "linelen = p - line;" just change that to also be the declaration: "unsigned int linelen = p - line;"
Attachment #8617868 - Flags: review?(mcmanus) → review-
Okay. I will fix that now.
Thanks.
Changes made to declare the variable 'linelen' where it is being used.
Attachment #8617868 - Attachment is obsolete: true
Attachment #8621141 - Flags: review?(mcmanus)
Attachment #8621141 - Flags: review?(mcmanus) → review+
thanks sanchit
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/821d5d971f7c
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.