Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Issue 9307114: Coverity: Initialize member variables. (Closed)

Created:
8 years, 10 months ago by James Hawkins
Modified:
8 years, 10 months ago
CC:
chromium-reviews, vrk (LEFT CHROMIUM), acolwell+watch_chromium.org, amit, annacc+watch_chromium.org, dcaiafa+watch_chromium.org, cbentzel+watch_chromium.org, jam, apatrick_chromium, joi+watch-content_chromium.org, wez+watch_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org, ihf+watch_chromium.org, ddorwin+watch_chromium.org, fischman+watch_chromium.org, sanjeevr, mihaip+watch_chromium.org, simonmorris+watch_chromium.org, sergeyu+watch_chromium.org, scherkus (not reviewing), jamiewalch+watch_chromium.org, hclam+watch_chromium.org, garykac+watch_chromium.org, Aaron Boodman, lambroslambrou+watch_chromium.org, alexeypa+watch_chromium.org
Visibility:
Public.

Description

Coverity: Initialize member variables. CID_COUNT=13 CID=102812,102838,102863,102867,102875,102891,102906,102924,102947,102964, 103070,103246,103259 BUG=none TEST=none R=groby Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=120913

Patch Set 1 #

Patch Set 2 : Win fix. #

Total comments: 5

Patch Set 3 : Review fix plus one more. #

Patch Set 4 : Build fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+21 lines, -7 lines) Patch
M base/debug/trace_event_impl.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/api/serial/serial_api.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/geolocation/chrome_access_token_store.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/sessions/session_types.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M content/common/gpu/media/dxva_video_decode_accelerator.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M net/http/http_response_body_drainer.cc View 1 chunk +2 lines, -1 line 0 comments Download
M net/proxy/proxy_script_decider.cc View 1 chunk +2 lines, -1 line 0 comments Download
M net/spdy/buffered_spdy_framer.cc View 1 chunk +1 line, -0 lines 0 comments Download
M ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M ppapi/native_client/src/trusted/plugin/module_ppapi.cc View 1 chunk +3 lines, -1 line 0 comments Download
M remoting/protocol/jingle_session_manager.cc View 1 chunk +1 line, -0 lines 0 comments Download
M remoting/protocol/negotiating_authenticator.cc View 1 chunk +2 lines, -1 line 0 comments Download
M webkit/plugins/ppapi/audio_helper.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 7 (0 generated)
James Hawkins
8 years, 10 months ago (2012-02-05 06:50:55 UTC) #1
Sergey Ulanov
remoting/* LGTM
8 years, 10 months ago (2012-02-05 09:48:53 UTC) #2
scherkus (not reviewing)
LGTM on content/common/gpu/media/dxva_video_decode_accelerator.cc
8 years, 10 months ago (2012-02-06 17:40:41 UTC) #3
dmichael (off chromium)
ppapi/* LGTM https://chromiumcodereview.appspot.com/9307114/diff/6001/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc File ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc (right): https://chromiumcodereview.appspot.com/9307114/diff/6001/ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc#newcode15 ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc:15: memset(&instance_1_1_, 0, sizeof(instance_1_1_)); doesn't it suffice to ...
8 years, 10 months ago (2012-02-06 18:38:07 UTC) #4
groby-ooo-7-16
LGTM - modulo resolving the perf question for TraceEvents http://codereview.chromium.org/9307114/diff/6001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): http://codereview.chromium.org/9307114/diff/6001/base/debug/trace_event_impl.cc#newcode148 base/debug/trace_event_impl.cc:148: ...
8 years, 10 months ago (2012-02-06 18:39:48 UTC) #5
James Hawkins
https://chromiumcodereview.appspot.com/9307114/diff/6001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://chromiumcodereview.appspot.com/9307114/diff/6001/base/debug/trace_event_impl.cc#newcode148 base/debug/trace_event_impl.cc:148: memset(arg_names_, 0, sizeof(arg_names_)); On 2012/02/06 18:39:48, groby wrote: > ...
8 years, 10 months ago (2012-02-07 21:09:20 UTC) #6
dmichael (off chromium)
8 years, 10 months ago (2012-02-07 21:30:19 UTC) #7
lgtm

https://chromiumcodereview.appspot.com/9307114/diff/6001/ppapi/native_client/...
File ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc
(right):

https://chromiumcodereview.appspot.com/9307114/diff/6001/ppapi/native_client/...
ppapi/native_client/src/shared/ppapi_proxy/ppp_instance_combined.cc:15:
memset(&instance_1_1_, 0, sizeof(instance_1_1_));
On 2012/02/07 21:09:21, James Hawkins wrote:
> On 2012/02/06 18:38:07, dmichael wrote:
> > doesn't it suffice to just put instance_1_1_() in the initializer list?
> 
> The default constructor doesn't initialize the POD types (in this case, the
> function pointers).
instance_1_1_ is a POD struct. Adding instance_1_1_() to the initializer list
"value-initializes" instance_1_1_, which means the pointers are all set to NULL.
See, e.g.:
http://stackoverflow.com/questions/3803153/what-are-primitive-types-default-i...

That said, not everyone knows that, so memset may be clearer. I'm fine either
way.

Powered by Google App Engine
This is Rietveld 408576698