Replace strcpy with talk_base::strcpyn.
Cpplint reports error 'Almost always, snprintf is better than strcpy' when checking code styles. The function talk_base::strcpyn() is a better option than strcpy(). BUG=1788 R=pbos@webrtc.org, wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12919004 Patch from Changbin Shao <changbin.shao@intel.com>. git-svn-id: http://webrtc.googlecode.com/svn/trunk@6686 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6823479ad3
commit
cb859ecd3b
@ -1097,7 +1097,8 @@ bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp) {
|
||||
memset(&codec, 0, sizeof(codec));
|
||||
|
||||
codec.plType = kDefaultVideoCodecPref.payload_type;
|
||||
strcpy(codec.plName, kDefaultVideoCodecPref.name);
|
||||
talk_base::strcpyn(codec.plName, ARRAY_SIZE(codec.plName),
|
||||
kDefaultVideoCodecPref.name);
|
||||
codec.codecType = webrtc::kVideoCodecVP8;
|
||||
codec.codecSpecific.VP8.resilience = webrtc::kResilientStream;
|
||||
codec.codecSpecific.VP8.numberOfTemporalLayers = 1;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "talk/base/gunit.h"
|
||||
#include "talk/base/stringutils.h"
|
||||
#include "talk/media/base/testutils.h"
|
||||
#include "talk/media/base/videoengine_unittest.h"
|
||||
#include "talk/media/webrtc/webrtcvideoengine2.h"
|
||||
@ -162,7 +163,8 @@ webrtc::VideoCodec FakeCall::GetEmptyVideoCodec() {
|
||||
webrtc::VideoCodec FakeCall::GetVideoCodecVp8() {
|
||||
webrtc::VideoCodec vp8_codec = GetEmptyVideoCodec();
|
||||
vp8_codec.codecType = webrtc::kVideoCodecVP8;
|
||||
strcpy(vp8_codec.plName, kVp8Codec.name.c_str());
|
||||
talk_base::strcpyn(vp8_codec.plName, ARRAY_SIZE(vp8_codec.plName),
|
||||
kVp8Codec.name.c_str());
|
||||
vp8_codec.plType = kVp8Codec.id;
|
||||
|
||||
return vp8_codec;
|
||||
@ -172,7 +174,8 @@ webrtc::VideoCodec FakeCall::GetVideoCodecVp9() {
|
||||
webrtc::VideoCodec vp9_codec = GetEmptyVideoCodec();
|
||||
// TODO(pbos): Add a correct codecType when webrtc has one.
|
||||
vp9_codec.codecType = webrtc::kVideoCodecVP8;
|
||||
strcpy(vp9_codec.plName, kVp9Codec.name.c_str());
|
||||
talk_base::strcpyn(vp9_codec.plName, ARRAY_SIZE(vp9_codec.plName),
|
||||
kVp9Codec.name.c_str());
|
||||
vp9_codec.plType = kVp9Codec.id;
|
||||
|
||||
return vp9_codec;
|
||||
|
Loading…
x
Reference in New Issue
Block a user