Delete _strnicmp. Uses replaced with abseil functions.
The replacements are absl::EqualsIgnoreCase and absl::StartsWithIgnoreCase. Also delete the alias RtpUtility::StringCompare. Bug: webrtc:6424 Change-Id: I4bed71540264450f85137ad0c2564125c5c6213f Reviewed-on: https://webrtc-review.googlesource.com/c/109006 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25481}
This commit is contained in:
@ -225,6 +225,7 @@ rtc_static_library("rtp_rtcp") {
|
||||
"../video_coding:codec_globals_headers",
|
||||
"//third_party/abseil-cpp/absl/container:inlined_vector",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
"//third_party/abseil-cpp/absl/types:variant",
|
||||
]
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
@ -272,12 +273,11 @@ int32_t RTPSender::DeregisterRtpHeaderExtension(RTPExtensionType type) {
|
||||
return rtp_header_extension_map_.Deregister(type);
|
||||
}
|
||||
|
||||
int32_t RTPSender::RegisterPayload(
|
||||
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
|
||||
int8_t payload_number,
|
||||
uint32_t frequency,
|
||||
size_t channels,
|
||||
uint32_t rate) {
|
||||
int32_t RTPSender::RegisterPayload(const char* payload_name,
|
||||
int8_t payload_number,
|
||||
uint32_t frequency,
|
||||
size_t channels,
|
||||
uint32_t rate) {
|
||||
RTC_DCHECK_LT(strlen(payload_name), RTP_PAYLOAD_NAME_SIZE);
|
||||
rtc::CritScope lock(&send_critsect_);
|
||||
|
||||
@ -290,8 +290,7 @@ int32_t RTPSender::RegisterPayload(
|
||||
RTC_DCHECK(payload);
|
||||
|
||||
// Check if it's the same as we already have.
|
||||
if (RtpUtility::StringCompare(payload->name, payload_name,
|
||||
RTP_PAYLOAD_NAME_SIZE - 1)) {
|
||||
if (absl::EqualsIgnoreCase(payload->name, payload_name)) {
|
||||
if (audio_configured_ && payload->typeSpecific.is_audio()) {
|
||||
auto& p = payload->typeSpecific.audio_payload();
|
||||
if (rtc::SafeEq(p.format.clockrate_hz, frequency) &&
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
@ -31,14 +32,13 @@ RTPSenderAudio::RTPSenderAudio(Clock* clock, RTPSender* rtp_sender)
|
||||
|
||||
RTPSenderAudio::~RTPSenderAudio() {}
|
||||
|
||||
int32_t RTPSenderAudio::RegisterAudioPayload(
|
||||
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
const int8_t payload_type,
|
||||
const uint32_t frequency,
|
||||
const size_t channels,
|
||||
const uint32_t rate,
|
||||
RtpUtility::Payload** payload) {
|
||||
if (RtpUtility::StringCompare(payloadName, "cn", 2)) {
|
||||
int32_t RTPSenderAudio::RegisterAudioPayload(const char* payloadName,
|
||||
const int8_t payload_type,
|
||||
const uint32_t frequency,
|
||||
const size_t channels,
|
||||
const uint32_t rate,
|
||||
RtpUtility::Payload** payload) {
|
||||
if (absl::EqualsIgnoreCase(payloadName, "cn")) {
|
||||
rtc::CritScope cs(&send_audio_critsect_);
|
||||
// we can have multiple CNG payload types
|
||||
switch (frequency) {
|
||||
@ -57,7 +57,7 @@ int32_t RTPSenderAudio::RegisterAudioPayload(
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
} else if (RtpUtility::StringCompare(payloadName, "telephone-event", 15)) {
|
||||
} else if (absl::EqualsIgnoreCase(payloadName, "telephone-event")) {
|
||||
rtc::CritScope cs(&send_audio_critsect_);
|
||||
// Don't add it to the list
|
||||
// we dont want to allow send with a DTMF payloadtype
|
||||
|
@ -31,7 +31,7 @@ class RTPSenderAudio {
|
||||
RTPSenderAudio(Clock* clock, RTPSender* rtp_sender);
|
||||
~RTPSenderAudio();
|
||||
|
||||
int32_t RegisterAudioPayload(const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
int32_t RegisterAudioPayload(const char* payloadName,
|
||||
int8_t payload_type,
|
||||
uint32_t frequency,
|
||||
size_t channels,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/crypto/frameencryptorinterface.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
@ -152,18 +153,18 @@ VideoCodecType RTPSenderVideo::VideoCodecType() const {
|
||||
|
||||
// Static.
|
||||
RtpUtility::Payload* RTPSenderVideo::CreateVideoPayload(
|
||||
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
|
||||
const char* payload_name,
|
||||
int8_t payload_type) {
|
||||
enum VideoCodecType video_type = kVideoCodecGeneric;
|
||||
if (RtpUtility::StringCompare(payload_name, "VP8", 3)) {
|
||||
if (absl::EqualsIgnoreCase(payload_name, "VP8")) {
|
||||
video_type = kVideoCodecVP8;
|
||||
} else if (RtpUtility::StringCompare(payload_name, "VP9", 3)) {
|
||||
} else if (absl::EqualsIgnoreCase(payload_name, "VP9")) {
|
||||
video_type = kVideoCodecVP9;
|
||||
} else if (RtpUtility::StringCompare(payload_name, "H264", 4)) {
|
||||
} else if (absl::EqualsIgnoreCase(payload_name, "H264")) {
|
||||
video_type = kVideoCodecH264;
|
||||
} else if (RtpUtility::StringCompare(payload_name, "I420", 4)) {
|
||||
} else if (absl::EqualsIgnoreCase(payload_name, "I420")) {
|
||||
video_type = kVideoCodecGeneric;
|
||||
} else if (RtpUtility::StringCompare(payload_name, "stereo", 6)) {
|
||||
} else if (absl::EqualsIgnoreCase(payload_name, "stereo")) {
|
||||
video_type = kVideoCodecGeneric;
|
||||
} else {
|
||||
video_type = kVideoCodecGeneric;
|
||||
|
@ -43,10 +43,6 @@ enum {
|
||||
* Misc utility routines
|
||||
*/
|
||||
|
||||
bool StringCompare(const char* str1, const char* str2, const uint32_t length) {
|
||||
return _strnicmp(str1, str2, length) == 0;
|
||||
}
|
||||
|
||||
size_t Word32Align(size_t size) {
|
||||
uint32_t remainder = size % 4;
|
||||
if (remainder != 0)
|
||||
|
@ -34,8 +34,6 @@ struct Payload {
|
||||
PayloadUnion typeSpecific;
|
||||
};
|
||||
|
||||
bool StringCompare(const char* str1, const char* str2, const uint32_t length);
|
||||
|
||||
// Round up to the nearest size that is a multiple of 4.
|
||||
size_t Word32Align(size_t size);
|
||||
|
||||
|
@ -38,6 +38,7 @@ rtc_static_library("video_capture_module") {
|
||||
"../../rtc_base:stringutils",
|
||||
"../../rtc_base/synchronization:rw_lock_wrapper",
|
||||
"../../system_wrappers",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/libyuv",
|
||||
]
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "modules/video_capture/device_info_impl.h"
|
||||
#include "modules/video_capture/video_capture_config.h"
|
||||
#include "rtc_base/logging.h"
|
||||
@ -42,14 +43,12 @@ int32_t DeviceInfoImpl::NumberOfCapabilities(const char* deviceUniqueIdUTF8) {
|
||||
|
||||
_apiLock.AcquireLockShared();
|
||||
|
||||
if (_lastUsedDeviceNameLength == strlen((char*)deviceUniqueIdUTF8)) {
|
||||
// Is it the same device that is asked for again.
|
||||
if (_strnicmp((char*)_lastUsedDeviceName, (char*)deviceUniqueIdUTF8,
|
||||
_lastUsedDeviceNameLength) == 0) {
|
||||
// yes
|
||||
_apiLock.ReleaseLockShared();
|
||||
return static_cast<int32_t>(_captureCapabilities.size());
|
||||
}
|
||||
// Is it the same device that is asked for again.
|
||||
if (absl::EqualsIgnoreCase(
|
||||
deviceUniqueIdUTF8,
|
||||
absl::string_view(_lastUsedDeviceName, _lastUsedDeviceNameLength))) {
|
||||
_apiLock.ReleaseLockShared();
|
||||
return static_cast<int32_t>(_captureCapabilities.size());
|
||||
}
|
||||
// Need to get exclusive rights to create the new capability map.
|
||||
_apiLock.ReleaseLockShared();
|
||||
@ -66,9 +65,9 @@ int32_t DeviceInfoImpl::GetCapability(const char* deviceUniqueIdUTF8,
|
||||
|
||||
ReadLockScoped cs(_apiLock);
|
||||
|
||||
if ((_lastUsedDeviceNameLength != strlen((char*)deviceUniqueIdUTF8)) ||
|
||||
(_strnicmp((char*)_lastUsedDeviceName, (char*)deviceUniqueIdUTF8,
|
||||
_lastUsedDeviceNameLength) != 0)) {
|
||||
if (!absl::EqualsIgnoreCase(
|
||||
deviceUniqueIdUTF8,
|
||||
absl::string_view(_lastUsedDeviceName, _lastUsedDeviceNameLength))) {
|
||||
_apiLock.ReleaseLockShared();
|
||||
_apiLock.AcquireLockExclusive();
|
||||
if (-1 == CreateCapabilityMap(deviceUniqueIdUTF8)) {
|
||||
@ -100,9 +99,9 @@ int32_t DeviceInfoImpl::GetBestMatchedCapability(
|
||||
return -1;
|
||||
|
||||
ReadLockScoped cs(_apiLock);
|
||||
if ((_lastUsedDeviceNameLength != strlen((char*)deviceUniqueIdUTF8)) ||
|
||||
(_strnicmp((char*)_lastUsedDeviceName, (char*)deviceUniqueIdUTF8,
|
||||
_lastUsedDeviceNameLength) != 0)) {
|
||||
if (!absl::EqualsIgnoreCase(
|
||||
deviceUniqueIdUTF8,
|
||||
absl::string_view(_lastUsedDeviceName, _lastUsedDeviceNameLength))) {
|
||||
_apiLock.ReleaseLockShared();
|
||||
_apiLock.AcquireLockExclusive();
|
||||
if (-1 == CreateCapabilityMap(deviceUniqueIdUTF8)) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/bytebuffer.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -461,7 +462,7 @@ void AsyncHttpsProxySocket::ProcessLine(char* data, size_t len) {
|
||||
return;
|
||||
}
|
||||
} else if ((state_ == PS_AUTHENTICATE) &&
|
||||
(_strnicmp(data, "Proxy-Authenticate:", 19) == 0)) {
|
||||
absl::StartsWithIgnoreCase(data, "Proxy-Authenticate:")) {
|
||||
std::string response, auth_method;
|
||||
switch (HttpAuthenticate(data + 19, len - 19, proxy_, "CONNECT", "/", user_,
|
||||
pass_, context_, response, auth_method)) {
|
||||
@ -489,12 +490,12 @@ void AsyncHttpsProxySocket::ProcessLine(char* data, size_t len) {
|
||||
unknown_mechanisms_.clear();
|
||||
break;
|
||||
}
|
||||
} else if (_strnicmp(data, "Content-Length:", 15) == 0) {
|
||||
} else if (absl::StartsWithIgnoreCase(data, "Content-Length:")) {
|
||||
content_length_ = strtoul(data + 15, 0, 0);
|
||||
} else if (_strnicmp(data, "Proxy-Connection: Keep-Alive", 28) == 0) {
|
||||
} else if (absl::StartsWithIgnoreCase(data, "Proxy-Connection: Keep-Alive")) {
|
||||
expect_close_ = false;
|
||||
/*
|
||||
} else if (_strnicmp(data, "Connection: close", 17) == 0) {
|
||||
} else if (absl::StartsWithIgnoreCase(data, "Connection: close") {
|
||||
expect_close_ = true;
|
||||
*/
|
||||
}
|
||||
|
@ -42,15 +42,6 @@
|
||||
#define STACK_ARRAY(TYPE, LEN) \
|
||||
static_cast<TYPE*>(::alloca((LEN) * sizeof(TYPE)))
|
||||
|
||||
|
||||
#if defined(WEBRTC_POSIX)
|
||||
|
||||
inline int _strnicmp(const char* s1, const char* s2, size_t n) {
|
||||
return strncasecmp(s1, s2, n);
|
||||
}
|
||||
|
||||
#endif // WEBRTC_POSIX
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Traits simplifies porting string functions to be CTYPE-agnostic
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user