Update compat extension APIs to something that does not assume contiguous storage

PiperOrigin-RevId: 696346042
pull/19249/head
Protobuf Team Bot 2 weeks ago committed by Copybara-Service
parent 5b0c837182
commit 72111c3b5a
  1. 17
      csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
  2. 16
      upb/message/compat.c
  3. 6
      upb/message/compat.h

@ -1,17 +0,0 @@
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#endregion
namespace Google.Protobuf.Reflection;
internal sealed partial class FeatureSetDescriptor
{
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
private const string DefaultsBase64 =
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
}

@ -17,13 +17,19 @@
// Must be last.
#include "upb/port/def.inc"
const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
const upb_Message* msg, size_t index) {
bool upb_Message_NextExtension(const upb_Message* msg,
const upb_MiniTableExtension** result,
uintptr_t* iter) {
size_t count;
const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
UPB_ASSERT(index < count);
return ext[index].ext;
size_t i = *iter;
if (i >= count) {
return false;
*result = NULL;
}
*result = ext[i].ext;
*iter = i + 1;
return true;
}
const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(

@ -25,9 +25,11 @@
extern "C" {
#endif
const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
const upb_Message* msg, size_t index);
#define kUpb_Message_ExtensionBegin 0;
bool upb_Message_NextExtension(const upb_Message* msg,
const upb_MiniTableExtension** result,
uintptr_t* iter);
// Returns the minitable with the given field number, or NULL on failure.
const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
const upb_Message* msg, uint32_t field_number);

Loading…
Cancel
Save