RESOLVED FIXED 40001
Fix "variable may be used before being set" warning in TextResourceDecoder::checkForHeadCharset
https://bugs.webkit.org/show_bug.cgi?id=40001
Summary Fix "variable may be used before being set" warning in TextResourceDecoder::c...
Laszlo Gombos
Reported 2010-06-01 08:26:12 PDT
The warning is coming from the RVCT compiler: "\webkit\WebCore\loader\textresourcedecoder.cpp", line 571: Warning: C2874W: len may be used before being set int len; ^ Checking the code revealed that this might be a limitation of the compiler as the code is correct and the value of len never read before it gets initialized. I propose to initialize len to 0 just to eliminate the false compiler warning.
Attachments
proposed patch (1.40 KB, patch)
2010-06-01 08:31 PDT, Laszlo Gombos
no flags
Laszlo Gombos
Comment 1 2010-06-01 08:31:51 PDT
Created attachment 57548 [details] proposed patch
WebKit Commit Bot
Comment 2 2010-06-01 20:03:47 PDT
Comment on attachment 57548 [details] proposed patch Clearing flags on attachment: 57548 Committed r60529: <http://trac.webkit.org/changeset/60529>
WebKit Commit Bot
Comment 3 2010-06-01 20:03:52 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 4 2010-06-01 20:44:49 PDT
Darin Adler
Comment 5 2010-06-02 10:00:15 PDT
(In reply to comment #0) > The warning is coming from the RVCT compiler: > > "\webkit\WebCore\loader\textresourcedecoder.cpp", line 571: Warning: C2874W: len may be used before being set > int len; > ^ > Checking the code revealed that this might be a limitation of the compiler as the code is correct and the value of len never read before it gets initialized. I propose to initialize len to 0 just to eliminate the false compiler warning. I'm not sure this is a good precedent. It's OK to change code to sidestep a mistaken warning, but this is the kind of thing that occurs in many places and I don't want to include lots of extra initialization just to quiet the compiler. Unless you think there's another reason that this kind of code change is good.
Note You need to log in before you can comment on or make changes to this bug.