Skip to content

Commit

Permalink
Avoid the use of std::char_traits<> for non-character type
Browse files Browse the repository at this point in the history
libc++ is deprecating std::char_traits for types other than char,
wchar_t and the like.

Bug: 1393769
Change-Id: Ic24de0b92feff2c46db77910c9629d0d34409cce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4058321
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1075907}
  • Loading branch information
zmodem authored and Chromium LUCI CQ committed Nov 26, 2022
1 parent a1a3134 commit 62559e8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/speech/chunked_byte_buffer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <stdint.h>

#include <cstring>
#include <string>
#include <vector>

Expand Down Expand Up @@ -46,17 +47,15 @@ TEST(ChunkedByteBufferTest, BasicTest) {
chunk = buffer.PopChunk();
EXPECT_TRUE(chunk != nullptr);
EXPECT_EQ(4U, chunk->size());
EXPECT_EQ(0, std::char_traits<uint8_t>::compare(kChunks + 4, &(*chunk)[0],
chunk->size()));
EXPECT_EQ(0, std::memcmp(kChunks + 4, chunk->data(), chunk->size()));
EXPECT_EQ(6U, buffer.GetTotalLength());
EXPECT_TRUE(buffer.HasChunks());

// Read and check chunk 2.
chunk = buffer.PopChunk();
EXPECT_TRUE(chunk != nullptr);
EXPECT_EQ(2U, chunk->size());
EXPECT_EQ(0, std::char_traits<uint8_t>::compare(kChunks + 12, &(*chunk)[0],
chunk->size()));
EXPECT_EQ(0, std::memcmp(kChunks + 12, chunk->data(), chunk->size()));
EXPECT_EQ(0U, buffer.GetTotalLength());
EXPECT_FALSE(buffer.HasChunks());

Expand Down

0 comments on commit 62559e8

Please sign in to comment.