Remove `include/grpc/impl/codegen/gpr_slice.h` (#31774)

pull/31805/head
Cheng-Yu Chung 2 years ago committed by GitHub
parent ad91404e0e
commit ac1dee8ac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      BUILD
  2. 4
      CMakeLists.txt
  3. 3
      Makefile
  4. 4
      build_autogenerated.yaml
  5. 1
      gRPC-Core.podspec
  6. 1
      grpc.gemspec
  7. 71
      include/grpc/impl/codegen/gpr_slice.h
  8. 20
      include/grpc/impl/codegen/slice.h
  9. 1
      include/grpc/module.modulemap
  10. 1
      package.xml
  11. 3
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  12. 4
      src/core/tsi/alts/handshaker/alts_tsi_utils.cc
  13. 4
      test/core/security/fetch_oauth2.cc
  14. 8
      test/core/slice/c_slice_buffer_test.cc
  15. 1
      test/core/surface/public_headers_must_be_c89.c
  16. 4
      test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.cc
  17. 2
      test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
  18. 2
      test/core/util/fuzzer_corpus_test.cc
  19. 6
      test/core/util/passthru_endpoint.cc
  20. 2
      test/cpp/util/cli_call.cc
  21. 1
      tools/doxygen/Doxyfile.c++
  22. 1
      tools/doxygen/Doxyfile.c++.internal
  23. 1
      tools/doxygen/Doxyfile.core
  24. 1
      tools/doxygen/Doxyfile.core.internal

@ -180,7 +180,6 @@ GPR_PUBLIC_HDRS = [
"include/grpc/impl/codegen/atm_gcc_sync.h", "include/grpc/impl/codegen/atm_gcc_sync.h",
"include/grpc/impl/codegen/atm_windows.h", "include/grpc/impl/codegen/atm_windows.h",
"include/grpc/impl/codegen/fork.h", "include/grpc/impl/codegen/fork.h",
"include/grpc/impl/codegen/gpr_slice.h",
"include/grpc/impl/codegen/gpr_types.h", "include/grpc/impl/codegen/gpr_types.h",
"include/grpc/impl/codegen/log.h", "include/grpc/impl/codegen/log.h",
"include/grpc/impl/codegen/port_platform.h", "include/grpc/impl/codegen/port_platform.h",

4
CMakeLists.txt generated

@ -1617,7 +1617,6 @@ foreach(_hdr
include/grpc/impl/codegen/atm_gcc_sync.h include/grpc/impl/codegen/atm_gcc_sync.h
include/grpc/impl/codegen/atm_windows.h include/grpc/impl/codegen/atm_windows.h
include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/fork.h
include/grpc/impl/codegen/gpr_slice.h
include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/gpr_types.h
include/grpc/impl/codegen/log.h include/grpc/impl/codegen/log.h
include/grpc/impl/codegen/port_platform.h include/grpc/impl/codegen/port_platform.h
@ -2457,7 +2456,6 @@ foreach(_hdr
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/fork.h
include/grpc/impl/codegen/gpr_slice.h
include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/gpr_types.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/log.h include/grpc/impl/codegen/log.h
@ -3063,7 +3061,6 @@ foreach(_hdr
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/fork.h
include/grpc/impl/codegen/gpr_slice.h
include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/gpr_types.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/log.h include/grpc/impl/codegen/log.h
@ -4541,7 +4538,6 @@ foreach(_hdr
include/grpc/impl/codegen/compression_types.h include/grpc/impl/codegen/compression_types.h
include/grpc/impl/codegen/connectivity_state.h include/grpc/impl/codegen/connectivity_state.h
include/grpc/impl/codegen/fork.h include/grpc/impl/codegen/fork.h
include/grpc/impl/codegen/gpr_slice.h
include/grpc/impl/codegen/gpr_types.h include/grpc/impl/codegen/gpr_types.h
include/grpc/impl/codegen/grpc_types.h include/grpc/impl/codegen/grpc_types.h
include/grpc/impl/codegen/log.h include/grpc/impl/codegen/log.h

3
Makefile generated

@ -889,7 +889,6 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/atm_gcc_sync.h \ include/grpc/impl/codegen/atm_gcc_sync.h \
include/grpc/impl/codegen/atm_windows.h \ include/grpc/impl/codegen/atm_windows.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \
include/grpc/impl/codegen/port_platform.h \ include/grpc/impl/codegen/port_platform.h \
@ -1691,7 +1690,6 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \
@ -2157,7 +2155,6 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \

@ -142,7 +142,6 @@ libs:
- include/grpc/impl/codegen/atm_gcc_sync.h - include/grpc/impl/codegen/atm_gcc_sync.h
- include/grpc/impl/codegen/atm_windows.h - include/grpc/impl/codegen/atm_windows.h
- include/grpc/impl/codegen/fork.h - include/grpc/impl/codegen/fork.h
- include/grpc/impl/codegen/gpr_slice.h
- include/grpc/impl/codegen/gpr_types.h - include/grpc/impl/codegen/gpr_types.h
- include/grpc/impl/codegen/log.h - include/grpc/impl/codegen/log.h
- include/grpc/impl/codegen/port_platform.h - include/grpc/impl/codegen/port_platform.h
@ -280,7 +279,6 @@ libs:
- include/grpc/impl/codegen/compression_types.h - include/grpc/impl/codegen/compression_types.h
- include/grpc/impl/codegen/connectivity_state.h - include/grpc/impl/codegen/connectivity_state.h
- include/grpc/impl/codegen/fork.h - include/grpc/impl/codegen/fork.h
- include/grpc/impl/codegen/gpr_slice.h
- include/grpc/impl/codegen/gpr_types.h - include/grpc/impl/codegen/gpr_types.h
- include/grpc/impl/codegen/grpc_types.h - include/grpc/impl/codegen/grpc_types.h
- include/grpc/impl/codegen/log.h - include/grpc/impl/codegen/log.h
@ -1858,7 +1856,6 @@ libs:
- include/grpc/impl/codegen/compression_types.h - include/grpc/impl/codegen/compression_types.h
- include/grpc/impl/codegen/connectivity_state.h - include/grpc/impl/codegen/connectivity_state.h
- include/grpc/impl/codegen/fork.h - include/grpc/impl/codegen/fork.h
- include/grpc/impl/codegen/gpr_slice.h
- include/grpc/impl/codegen/gpr_types.h - include/grpc/impl/codegen/gpr_types.h
- include/grpc/impl/codegen/grpc_types.h - include/grpc/impl/codegen/grpc_types.h
- include/grpc/impl/codegen/log.h - include/grpc/impl/codegen/log.h
@ -3393,7 +3390,6 @@ libs:
- include/grpc/impl/codegen/compression_types.h - include/grpc/impl/codegen/compression_types.h
- include/grpc/impl/codegen/connectivity_state.h - include/grpc/impl/codegen/connectivity_state.h
- include/grpc/impl/codegen/fork.h - include/grpc/impl/codegen/fork.h
- include/grpc/impl/codegen/gpr_slice.h
- include/grpc/impl/codegen/gpr_types.h - include/grpc/impl/codegen/gpr_types.h
- include/grpc/impl/codegen/grpc_types.h - include/grpc/impl/codegen/grpc_types.h
- include/grpc/impl/codegen/log.h - include/grpc/impl/codegen/log.h

1
gRPC-Core.podspec generated

@ -130,7 +130,6 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/compression_types.h', 'include/grpc/impl/codegen/compression_types.h',
'include/grpc/impl/codegen/connectivity_state.h', 'include/grpc/impl/codegen/connectivity_state.h',
'include/grpc/impl/codegen/fork.h', 'include/grpc/impl/codegen/fork.h',
'include/grpc/impl/codegen/gpr_slice.h',
'include/grpc/impl/codegen/gpr_types.h', 'include/grpc/impl/codegen/gpr_types.h',
'include/grpc/impl/codegen/grpc_types.h', 'include/grpc/impl/codegen/grpc_types.h',
'include/grpc/impl/codegen/log.h', 'include/grpc/impl/codegen/log.h',

1
grpc.gemspec generated

@ -73,7 +73,6 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/compression_types.h ) s.files += %w( include/grpc/impl/codegen/compression_types.h )
s.files += %w( include/grpc/impl/codegen/connectivity_state.h ) s.files += %w( include/grpc/impl/codegen/connectivity_state.h )
s.files += %w( include/grpc/impl/codegen/fork.h ) s.files += %w( include/grpc/impl/codegen/fork.h )
s.files += %w( include/grpc/impl/codegen/gpr_slice.h )
s.files += %w( include/grpc/impl/codegen/gpr_types.h ) s.files += %w( include/grpc/impl/codegen/gpr_types.h )
s.files += %w( include/grpc/impl/codegen/grpc_types.h ) s.files += %w( include/grpc/impl/codegen/grpc_types.h )
s.files += %w( include/grpc/impl/codegen/log.h ) s.files += %w( include/grpc/impl/codegen/log.h )

@ -1,71 +0,0 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_IMPL_CODEGEN_GPR_SLICE_H
#define GRPC_IMPL_CODEGEN_GPR_SLICE_H
// IWYU pragma: private
/** WARNING: Please do not use this header. This was added as a temporary
* measure to not break some of the external projects that depend on
* gpr_slice_* functions. We are actively working on moving all the
* gpr_slice_* references to grpc_slice_* and this file will be removed
*/
/* TODO (sreek) - Allowed by default but will be very soon turned off */
#define GRPC_ALLOW_GPR_SLICE_FUNCTIONS 1
#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
#define gpr_slice_refcount grpc_slice_refcount
#define gpr_slice grpc_slice
#define gpr_slice_buffer grpc_slice_buffer
#define gpr_slice_ref grpc_slice_ref
#define gpr_slice_unref grpc_slice_unref
#define gpr_slice_new grpc_slice_new
#define gpr_slice_new_with_user_data grpc_slice_new_with_user_data
#define gpr_slice_new_with_len grpc_slice_new_with_len
#define gpr_slice_malloc grpc_slice_malloc
#define gpr_slice_from_copied_string grpc_slice_from_copied_string
#define gpr_slice_from_copied_buffer grpc_slice_from_copied_buffer
#define gpr_slice_from_static_string grpc_slice_from_static_string
#define gpr_slice_sub grpc_slice_sub
#define gpr_slice_sub_no_ref grpc_slice_sub_no_ref
#define gpr_slice_split_tail grpc_slice_split_tail
#define gpr_slice_split_head grpc_slice_split_head
#define gpr_slice_cmp grpc_slice_cmp
#define gpr_slice_str_cmp grpc_slice_str_cmp
#define gpr_slice_buffer grpc_slice_buffer
#define gpr_slice_buffer_init grpc_slice_buffer_init
#define gpr_slice_buffer_destroy grpc_slice_buffer_destroy
#define gpr_slice_buffer_add grpc_slice_buffer_add
#define gpr_slice_buffer_add_indexed grpc_slice_buffer_add_indexed
#define gpr_slice_buffer_addn grpc_slice_buffer_addn
#define gpr_slice_buffer_tiny_add grpc_slice_buffer_tiny_add
#define gpr_slice_buffer_pop grpc_slice_buffer_pop
#define gpr_slice_buffer_reset_and_unref grpc_slice_buffer_reset_and_unref
#define gpr_slice_buffer_swap grpc_slice_buffer_swap
#define gpr_slice_buffer_move_into grpc_slice_buffer_move_into
#define gpr_slice_buffer_trim_end grpc_slice_buffer_trim_end
#define gpr_slice_buffer_move_first grpc_slice_buffer_move_first
#define gpr_slice_buffer_take_first grpc_slice_buffer_take_first
#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
#endif /* GRPC_IMPL_CODEGEN_GPR_SLICE_H */

@ -25,8 +25,6 @@
#include <stddef.h> #include <stddef.h>
#include <grpc/impl/codegen/gpr_slice.h>
typedef struct grpc_slice grpc_slice; typedef struct grpc_slice grpc_slice;
/** Slice API /** Slice API
@ -111,22 +109,4 @@ typedef struct grpc_slice_buffer {
GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice) GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0) #define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
/* Duplicate GPR_* definitions */
#define GPR_SLICE_START_PTR(slice) \
((slice).refcount ? (slice).data.refcounted.bytes \
: (slice).data.inlined.bytes)
#define GPR_SLICE_LENGTH(slice) \
((slice).refcount ? (slice).data.refcounted.length \
: (slice).data.inlined.length)
#define GPR_SLICE_SET_LENGTH(slice, newlen) \
((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
: ((slice).data.inlined.length = (uint8_t)(newlen)))
#define GPR_SLICE_END_PTR(slice) \
GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
#define GPR_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
#endif /* GRPC_IMPL_CODEGEN_SLICE_H */ #endif /* GRPC_IMPL_CODEGEN_SLICE_H */

@ -17,7 +17,6 @@ header "byte_buffer.h"
header "impl/codegen/compression_types.h" header "impl/codegen/compression_types.h"
header "impl/codegen/connectivity_state.h" header "impl/codegen/connectivity_state.h"
header "impl/codegen/fork.h" header "impl/codegen/fork.h"
header "impl/codegen/gpr_slice.h"
header "impl/codegen/gpr_types.h" header "impl/codegen/gpr_types.h"
header "impl/codegen/grpc_types.h" header "impl/codegen/grpc_types.h"
header "impl/codegen/log.h" header "impl/codegen/log.h"

1
package.xml generated

@ -55,7 +55,6 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/connectivity_state.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/fork.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/fork.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/gpr_slice.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/gpr_types.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/gpr_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/grpc_types.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/grpc_types.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/log.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/log.h" role="src" />

@ -37,7 +37,6 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
#include <grpc/impl/codegen/gpr_slice.h>
#include <grpc/slice.h> #include <grpc/slice.h>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
@ -529,7 +528,7 @@ void MaybeAddToBody(const char* field_name, const char* field,
body->push_back(absl::StrFormat("&%s=%s", field_name, field)); body->push_back(absl::StrFormat("&%s=%s", field_name, field));
} }
grpc_error_handle LoadTokenFile(const char* path, gpr_slice* token) { grpc_error_handle LoadTokenFile(const char* path, grpc_slice* token) {
grpc_error_handle err = grpc_load_file(path, 1, token); grpc_error_handle err = grpc_load_file(path, 1, token);
if (!err.ok()) return err; if (!err.ok()) return err;
if (GRPC_SLICE_LENGTH(*token) == 0) { if (GRPC_SLICE_LENGTH(*token) == 0) {

@ -49,9 +49,9 @@ grpc_gcp_HandshakerResp* alts_tsi_utils_deserialize_response(
grpc_byte_buffer_reader bbr; grpc_byte_buffer_reader bbr;
grpc_byte_buffer_reader_init(&bbr, resp_buffer); grpc_byte_buffer_reader_init(&bbr, resp_buffer);
grpc_slice slice = grpc_byte_buffer_reader_readall(&bbr); grpc_slice slice = grpc_byte_buffer_reader_readall(&bbr);
size_t buf_size = GPR_SLICE_LENGTH(slice); size_t buf_size = GRPC_SLICE_LENGTH(slice);
void* buf = upb_Arena_Malloc(arena, buf_size); void* buf = upb_Arena_Malloc(arena, buf_size);
memcpy(buf, reinterpret_cast<const char*>(GPR_SLICE_START_PTR(slice)), memcpy(buf, reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(slice)),
buf_size); buf_size);
grpc_gcp_HandshakerResp* resp = grpc_gcp_HandshakerResp_parse( grpc_gcp_HandshakerResp* resp = grpc_gcp_HandshakerResp_parse(
reinterpret_cast<char*>(buf), buf_size, arena); reinterpret_cast<char*>(buf), buf_size, arena);

@ -50,7 +50,7 @@ static grpc_call_credentials* create_sts_creds(const char* json_file_path) {
auto status = grpc::experimental::StsCredentialsOptionsFromJson( auto status = grpc::experimental::StsCredentialsOptionsFromJson(
reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(sts_options_slice)), reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(sts_options_slice)),
&options); &options);
gpr_slice_unref(sts_options_slice); grpc_slice_unref(sts_options_slice);
if (!status.ok()) { if (!status.ok()) {
gpr_log(GPR_ERROR, "%s", status.error_message().c_str()); gpr_log(GPR_ERROR, "%s", status.error_message().c_str());
return nullptr; return nullptr;
@ -71,7 +71,7 @@ static grpc_call_credentials* create_refresh_token_creds(
grpc_call_credentials* result = grpc_google_refresh_token_credentials_create( grpc_call_credentials* result = grpc_google_refresh_token_credentials_create(
reinterpret_cast<const char*> GRPC_SLICE_START_PTR(refresh_token), reinterpret_cast<const char*> GRPC_SLICE_START_PTR(refresh_token),
nullptr); nullptr);
gpr_slice_unref(refresh_token); grpc_slice_unref(refresh_token);
return result; return result;
} }

@ -156,25 +156,25 @@ void test_slice_buffer_first() {
} }
grpc_slice* first = grpc_slice_buffer_peek_first(&buf); grpc_slice* first = grpc_slice_buffer_peek_first(&buf);
ASSERT_EQ(GPR_SLICE_LENGTH(*first), GPR_SLICE_LENGTH(slices[0])); ASSERT_EQ(GRPC_SLICE_LENGTH(*first), GRPC_SLICE_LENGTH(slices[0]));
ASSERT_EQ(buf.count, 3); ASSERT_EQ(buf.count, 3);
ASSERT_EQ(buf.length, 12); ASSERT_EQ(buf.length, 12);
grpc_slice_buffer_sub_first(&buf, 1, 2); grpc_slice_buffer_sub_first(&buf, 1, 2);
first = grpc_slice_buffer_peek_first(&buf); first = grpc_slice_buffer_peek_first(&buf);
ASSERT_EQ(GPR_SLICE_LENGTH(*first), 1); ASSERT_EQ(GRPC_SLICE_LENGTH(*first), 1);
ASSERT_EQ(buf.count, 3); ASSERT_EQ(buf.count, 3);
ASSERT_EQ(buf.length, 10); ASSERT_EQ(buf.length, 10);
grpc_slice_buffer_remove_first(&buf); grpc_slice_buffer_remove_first(&buf);
first = grpc_slice_buffer_peek_first(&buf); first = grpc_slice_buffer_peek_first(&buf);
ASSERT_EQ(GPR_SLICE_LENGTH(*first), GPR_SLICE_LENGTH(slices[1])); ASSERT_EQ(GRPC_SLICE_LENGTH(*first), GRPC_SLICE_LENGTH(slices[1]));
ASSERT_EQ(buf.count, 2); ASSERT_EQ(buf.count, 2);
ASSERT_EQ(buf.length, 9); ASSERT_EQ(buf.length, 9);
grpc_slice_buffer_remove_first(&buf); grpc_slice_buffer_remove_first(&buf);
first = grpc_slice_buffer_peek_first(&buf); first = grpc_slice_buffer_peek_first(&buf);
ASSERT_EQ(GPR_SLICE_LENGTH(*first), GPR_SLICE_LENGTH(slices[2])); ASSERT_EQ(GRPC_SLICE_LENGTH(*first), GRPC_SLICE_LENGTH(slices[2]));
ASSERT_EQ(buf.count, 1); ASSERT_EQ(buf.count, 1);
ASSERT_EQ(buf.length, 5); ASSERT_EQ(buf.length, 5);

@ -30,7 +30,6 @@
#include <grpc/impl/codegen/compression_types.h> #include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/connectivity_state.h> #include <grpc/impl/codegen/connectivity_state.h>
#include <grpc/impl/codegen/fork.h> #include <grpc/impl/codegen/fork.h>
#include <grpc/impl/codegen/gpr_slice.h>
#include <grpc/impl/codegen/gpr_types.h> #include <grpc/impl/codegen/gpr_types.h>
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/log.h> #include <grpc/impl/codegen/log.h>

@ -43,9 +43,9 @@ bool grpc_gcp_handshaker_resp_set_peer_rpc_versions(
grpc_gcp_HandshakerReq* grpc_gcp_handshaker_req_decode(grpc_slice slice, grpc_gcp_HandshakerReq* grpc_gcp_handshaker_req_decode(grpc_slice slice,
upb_Arena* arena) { upb_Arena* arena) {
size_t buf_size = GPR_SLICE_LENGTH(slice); size_t buf_size = GRPC_SLICE_LENGTH(slice);
void* buf = upb_Arena_Malloc(arena, buf_size); void* buf = upb_Arena_Malloc(arena, buf_size);
memcpy(buf, reinterpret_cast<const char*>(GPR_SLICE_START_PTR(slice)), memcpy(buf, reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(slice)),
buf_size); buf_size);
grpc_gcp_HandshakerReq* resp = grpc_gcp_HandshakerReq_parse( grpc_gcp_HandshakerReq* resp = grpc_gcp_HandshakerReq_parse(
reinterpret_cast<char*>(buf), buf_size, arena); reinterpret_cast<char*>(buf), buf_size, arena);

@ -225,7 +225,7 @@ static grpc_byte_buffer* generate_handshaker_response(
} }
size_t buf_len; size_t buf_len;
char* buf = grpc_gcp_HandshakerResp_serialize(resp, arena.ptr(), &buf_len); char* buf = grpc_gcp_HandshakerResp_serialize(resp, arena.ptr(), &buf_len);
grpc_slice slice = gpr_slice_from_copied_buffer(buf, buf_len); grpc_slice slice = grpc_slice_from_copied_buffer(buf, buf_len);
if (type == INVALID) { if (type == INVALID) {
grpc_slice bad_slice = grpc_slice bad_slice =
grpc_slice_split_head(&slice, GRPC_SLICE_LENGTH(slice) - 1); grpc_slice_split_head(&slice, GRPC_SLICE_LENGTH(slice) - 1);

@ -62,7 +62,7 @@ TEST_P(FuzzerCorpusTest, RunOneExample) {
size_t length = GRPC_SLICE_LENGTH(buffer); size_t length = GRPC_SLICE_LENGTH(buffer);
void* data = gpr_malloc(length); void* data = gpr_malloc(length);
if (length > 0) { if (length > 0) {
memcpy(data, GPR_SLICE_START_PTR(buffer), length); memcpy(data, GRPC_SLICE_START_PTR(buffer), length);
} }
grpc_slice_unref(buffer); grpc_slice_unref(buffer);
LLVMFuzzerTestOneInput(static_cast<uint8_t*>(data), length); LLVMFuzzerTestOneInput(static_cast<uint8_t*>(data), length);

@ -207,7 +207,7 @@ static void do_pending_write_op_locked(half* m, grpc_error_handle error) {
other->on_read != nullptr ? other->on_read_out : &other->read_buffer; other->on_read != nullptr ? other->on_read_out : &other->read_buffer;
while (max_writable > 0) { while (max_writable > 0) {
grpc_slice slice = grpc_slice_buffer_take_first(slices); grpc_slice slice = grpc_slice_buffer_take_first(slices);
uint64_t slice_length = GPR_SLICE_LENGTH(slice); uint64_t slice_length = GRPC_SLICE_LENGTH(slice);
GPR_ASSERT(slice_length > 0); GPR_ASSERT(slice_length > 0);
grpc_slice split1, split2; grpc_slice split1, split2;
uint64_t split_length = 0; uint64_t split_length = 0;
@ -230,7 +230,7 @@ static void do_pending_write_op_locked(half* m, grpc_error_handle error) {
// Write a copy of the slice to the destination to be read // Write a copy of the slice to the destination to be read
grpc_slice_buffer_add_indexed(dest, split1); grpc_slice_buffer_add_indexed(dest, split1);
// Re-insert split2 into source for next iteration. // Re-insert split2 into source for next iteration.
if (GPR_SLICE_LENGTH(split2) > 0) { if (GRPC_SLICE_LENGTH(split2) > 0) {
grpc_slice_buffer_undo_take_first(slices, split2); grpc_slice_buffer_undo_take_first(slices, split2);
} else { } else {
grpc_slice_unref(split2); grpc_slice_unref(split2);
@ -277,7 +277,7 @@ static void me_write(grpc_endpoint* ep, grpc_slice_buffer* slices,
m->pending_write_op.slices = &m->write_buffer; m->pending_write_op.slices = &m->write_buffer;
GPR_ASSERT(m->pending_write_op.slices->count == 0); GPR_ASSERT(m->pending_write_op.slices->count == 0);
for (int i = 0; i < static_cast<int>(slices->count); i++) { for (int i = 0; i < static_cast<int>(slices->count); i++) {
if (GPR_SLICE_LENGTH(slices->slices[i]) > 0) { if (GRPC_SLICE_LENGTH(slices->slices[i]) > 0) {
grpc_slice_buffer_add_indexed(m->pending_write_op.slices, grpc_slice_buffer_add_indexed(m->pending_write_op.slices,
grpc_slice_copy(slices->slices[i])); grpc_slice_copy(slices->slices[i]));
} }

@ -91,7 +91,7 @@ void CliCall::Write(const std::string& request) {
void* got_tag; void* got_tag;
bool ok; bool ok;
gpr_slice s = gpr_slice_from_copied_buffer(request.data(), request.size()); grpc_slice s = grpc_slice_from_copied_buffer(request.data(), request.size());
grpc::Slice req_slice(s, grpc::Slice::STEAL_REF); grpc::Slice req_slice(s, grpc::Slice::STEAL_REF);
grpc::ByteBuffer send_buffer(&req_slice, 1); grpc::ByteBuffer send_buffer(&req_slice, 1);
call_->Write(send_buffer, tag(2)); call_->Write(send_buffer, tag(2));

@ -903,7 +903,6 @@ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \

@ -903,7 +903,6 @@ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \

@ -833,7 +833,6 @@ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \

@ -833,7 +833,6 @@ include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \ include/grpc/impl/codegen/compression_types.h \
include/grpc/impl/codegen/connectivity_state.h \ include/grpc/impl/codegen/connectivity_state.h \
include/grpc/impl/codegen/fork.h \ include/grpc/impl/codegen/fork.h \
include/grpc/impl/codegen/gpr_slice.h \
include/grpc/impl/codegen/gpr_types.h \ include/grpc/impl/codegen/gpr_types.h \
include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/grpc_types.h \
include/grpc/impl/codegen/log.h \ include/grpc/impl/codegen/log.h \

Loading…
Cancel
Save