move the wire type definitions into upb/wire/ where they belong

PiperOrigin-RevId: 489500430
pull/13171/head
Eric Salo 2 years ago committed by Copybara-Service
parent 26febb8422
commit ff6439fba0
  1. 4
      BUILD
  2. 1
      python/BUILD
  3. 1
      python/unknown_fields.c
  4. 11
      upb/base/descriptor_constants.h
  5. 1
      upb/message/accessors.c
  6. 1
      upb/text/encode.c
  7. 1
      upb/util/BUILD
  8. 3
      upb/util/compare.c
  9. 1
      upb/util/compare_test.cc
  10. 1
      upb/wire/decode.c
  11. 1
      upb/wire/encode.c
  12. 41
      upb/wire/types.h

@ -287,6 +287,7 @@ cc_library(
":mini_table_internal",
":port",
":upb",
":wire",
],
)
@ -597,6 +598,7 @@ cc_library(
":lex",
":port",
":reflection",
":wire",
],
)
@ -1047,6 +1049,7 @@ cc_library(
hdrs = [
"upb/wire/decode.h",
"upb/wire/encode.h",
"upb/wire/types.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//visibility:public"],
@ -1073,6 +1076,7 @@ cc_library(
"upb/wire/decode_internal.h",
"upb/wire/encode.h",
"upb/wire/swap_internal.h",
"upb/wire/types.h",
],
copts = UPB_DEFAULT_COPTS,
visibility = ["//:__subpackages__"],

@ -214,6 +214,7 @@ py_extension(
"//:reflection",
"//:textformat",
"//:upb",
"//:wire",
"//upb/util:compare",
"//upb/util:def_to_proto",
"//upb/util:required_fields",

@ -29,6 +29,7 @@
#include "python/message.h"
#include "python/protobuf.h"
#include "upb/wire/types.h"
static const char* PyUpb_DecodeVarint(const char* ptr, const char* end,
uint64_t* val) {

@ -28,17 +28,6 @@
#ifndef UPB_BASE_DESCRIPTOR_CONSTANTS_H_
#define UPB_BASE_DESCRIPTOR_CONSTANTS_H_
// A list of types as they are encoded on-the-wire.
// TODO(salo): Move this into upb/wire/
typedef enum {
kUpb_WireType_Varint = 0,
kUpb_WireType_64Bit = 1,
kUpb_WireType_Delimited = 2,
kUpb_WireType_StartGroup = 3,
kUpb_WireType_EndGroup = 4,
kUpb_WireType_32Bit = 5
} upb_WireType;
// The types a field can have. Note that this list is not identical to the
// types defined in descriptor.proto, which gives INT32 and SINT32 separate
// types (we distinguish the two with the "integer encoding" enum below).

@ -31,6 +31,7 @@
#include "upb/message/message.h"
#include "upb/wire/decode.h"
#include "upb/wire/encode.h"
#include "upb/wire/types.h"
// Must be last.
#include "upb/port/def.inc"

@ -38,6 +38,7 @@
#include "upb/lex/round_trip.h"
#include "upb/port/vsnprintf_compat.h"
#include "upb/reflection/message.h"
#include "upb/wire/types.h"
// Must be last.
#include "upb/port/def.inc"

@ -109,6 +109,7 @@ cc_library(
deps = [
"//:port",
"//:reflection",
"//:wire",
],
)

@ -27,6 +27,9 @@
#include "upb/util/compare.h"
#include "upb/wire/types.h"
// Must be last.
#include "upb/port/def.inc"
struct upb_UnknownFields;

@ -36,6 +36,7 @@
#include "gtest/gtest.h"
#include "absl/strings/string_view.h"
#include "upb/wire/swap_internal.h"
#include "upb/wire/types.h"
struct UnknownField;

@ -35,6 +35,7 @@
#include "upb/wire/common_internal.h"
#include "upb/wire/decode_internal.h"
#include "upb/wire/swap_internal.h"
#include "upb/wire/types.h"
// Must be last.
#include "upb/port/def.inc"

@ -35,6 +35,7 @@
#include "upb/collections/map_sorter_internal.h"
#include "upb/wire/common_internal.h"
#include "upb/wire/swap_internal.h"
#include "upb/wire/types.h"
// Must be last.
#include "upb/port/def.inc"

@ -0,0 +1,41 @@
/*
* Copyright (c) 2009-2021, Google LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Google LLC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UPB_WIRE_TYPES_H_
#define UPB_WIRE_TYPES_H_
// A list of types as they are encoded on the wire.
typedef enum {
kUpb_WireType_Varint = 0,
kUpb_WireType_64Bit = 1,
kUpb_WireType_Delimited = 2,
kUpb_WireType_StartGroup = 3,
kUpb_WireType_EndGroup = 4,
kUpb_WireType_32Bit = 5
} upb_WireType;
#endif /* UPB_WIRE_TYPES_H_ */
Loading…
Cancel
Save