Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:17

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2023 Google LLC.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 #ifndef UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
0009 #define UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_
0010 
0011 #include <stddef.h>
0012 
0013 // Must be last.
0014 #include "upb/port/def.inc"
0015 
0016 #ifdef __cplusplus
0017 extern "C" {
0018 #endif
0019 
0020 // Returns true if unknown fields from the two messages are equal when sorted
0021 // and varints are made canonical.
0022 //
0023 // This function is discouraged, as the comparison is inherently lossy without
0024 // schema data:
0025 //
0026 //  1. We don't know whether delimited fields are sub-messages. Unknown
0027 //     sub-messages will therefore not have their fields sorted and varints
0028 //     canonicalized.
0029 //  2. We don't know about oneof/non-repeated fields, which should semantically
0030 //     discard every value except the last.
0031 
0032 typedef enum {
0033   kUpb_UnknownCompareResult_Equal = 0,
0034   kUpb_UnknownCompareResult_NotEqual = 1,
0035   kUpb_UnknownCompareResult_OutOfMemory = 2,
0036   kUpb_UnknownCompareResult_MaxDepthExceeded = 3,
0037 } upb_UnknownCompareResult;
0038 
0039 upb_UnknownCompareResult UPB_PRIVATE(_upb_Message_UnknownFieldsAreEqual)(
0040     const char* buf1, size_t size1, const char* buf2, size_t size2,
0041     int max_depth);
0042 
0043 #ifdef __cplusplus
0044 } /* extern "C" */
0045 #endif
0046 
0047 #include "upb/port/undef.inc"
0048 
0049 #endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */