Line data Source code
1 : /* 2 : * Copyright 2022 Google Inc. All rights reserved. 3 : * 4 : * Licensed under the Apache License, Version 2.0 (the "License"); 5 : * you may not use this file except in compliance with the License. 6 : * You may obtain a copy of the License at 7 : * 8 : * http://www.apache.org/licenses/LICENSE-2.0 9 : * 10 : * Unless required by applicable law or agreed to in writing, software 11 : * distributed under the License is distributed on an "AS IS" BASIS, 12 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 : * See the License for the specific language governing permissions and 14 : * limitations under the License. 15 : */ 16 : 17 : #ifndef FLATBUFFERS_FLEX_FLAT_UTIL_H_ 18 : #define FLATBUFFERS_FLEX_FLAT_UTIL_H_ 19 : 20 : #include "flatbuffers/flatbuffers.h" 21 : #include "flatbuffers/flexbuffers.h" 22 : 23 : namespace flexbuffers { 24 : 25 : // Verifies the `nested` flexbuffer within a flatbuffer vector is valid. 26 2194 : inline bool VerifyNestedFlexBuffer( 27 : const flatbuffers::Vector<uint8_t> *const nested, 28 : flatbuffers::Verifier &verifier) { 29 2194 : if (!nested) return true; 30 2114 : return verifier.Check(flexbuffers::VerifyBuffer( 31 2114 : nested->data(), nested->size(), verifier.GetFlexReuseTracker())); 32 : } 33 : 34 : } // namespace flexbuffers 35 : 36 : #endif // FLATBUFFERS_FLEX_FLAT_UTIL_H_