Use strncmp over grpc_slice_str_cmp

pull/16407/head
ncteisen 7 years ago
parent ca77fcd7cd
commit 58e99b6377
  1. 7
      include/grpcpp/impl/codegen/metadata_map.h

@ -20,7 +20,6 @@
#define GRPCPP_IMPL_CODEGEN_METADATA_MAP_H
#include <grpc/impl/codegen/log.h>
#include <grpc/slice.h>
#include <grpcpp/impl/codegen/slice.h>
namespace grpc {
@ -51,8 +50,10 @@ class MetadataMap {
// like code and message.
else {
for (size_t i = 0; i < arr_.count; i++) {
if (grpc_slice_str_cmp(arr_.metadata[i].key, kBinaryErrorDetailsKey) ==
0) {
if (strncmp(reinterpret_cast<const char*>(
GRPC_SLICE_START_PTR(arr_.metadata[i].key)),
kBinaryErrorDetailsKey,
GRPC_SLICE_LENGTH(arr_.metadata[i].key)) == 0) {
return grpc::string(reinterpret_cast<const char*>(
GRPC_SLICE_START_PTR(arr_.metadata[i].value)),
GRPC_SLICE_LENGTH(arr_.metadata[i].value));

Loading…
Cancel
Save