Letting strncpy do its job. Landing and extending http://webrtc-codereview.appspot.com/329010/ on behalf of tbreisacher.

Review URL: http://webrtc-codereview.appspot.com/335009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1260 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
niklas.enbom@webrtc.org 2011-12-21 08:59:31 +00:00
parent 8c5d24266e
commit 6c9be123ef

View File

@ -457,16 +457,13 @@ void RemoteRateControl::StateStr(RateControlState state, char* str)
switch (state) switch (state)
{ {
case kRcDecrease: case kRcDecrease:
strncpy(str, "DECREASE", 8); strncpy(str, "DECREASE", 9);
str[8] = 0;
break; break;
case kRcHold: case kRcHold:
strncpy(str, "HOLD", 4); strncpy(str, "HOLD", 5);
str[4] = 0;
break; break;
case kRcIncrease: case kRcIncrease:
strncpy(str, "INCREASE", 8); strncpy(str, "INCREASE", 9);
str[8] = 0;
break; break;
} }
} }
@ -476,16 +473,13 @@ void RemoteRateControl::StateStr(BandwidthUsage state, char* str)
switch (state) switch (state)
{ {
case kBwNormal: case kBwNormal:
strncpy(str, "NORMAL", 6); strncpy(str, "NORMAL", 7);
str[6] = 0;
break; break;
case kBwOverusing: case kBwOverusing:
strncpy(str, "OVER USING", 10); strncpy(str, "OVER USING", 11);
str[10] = 0;
break; break;
case kBwUnderUsing: case kBwUnderUsing:
strncpy(str, "UNDER USING", 11); strncpy(str, "UNDER USING", 12);
str[11] = 0;
break; break;
} }
} }