From f9ac2a4f9a86c41596bd5907b09e7210a5e2aaf9 Mon Sep 17 00:00:00 2001 From: wbq_sky Date: Mon, 5 Jul 2021 03:44:04 +0800 Subject: [PATCH] remove the unrelated code Signed-off-by: wbq_sky --- .../common/src/flatbuffer_schema.cpp | 26 +------------------ .../libs/distributeddb/include/types_export.h | 6 ----- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp b/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp index a9f97fe0e..55374327c 100755 --- a/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp +++ b/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp @@ -14,9 +14,6 @@ */ #include "schema_object.h" -#ifndef OMIT_FLATBUFFER -#include -#endif // OMIT_FLATBUFFER #include #include #include "schema_utils.h" @@ -67,28 +64,7 @@ bool SchemaObject::FlatBufferSchema::IsFlatBufferSchema(const std::string &inOri outDecoded = inOriginal; // The original one is the decoded one return true; } - // Try base64 decode. base64 decoded length less then original length. - outDecoded.resize(inOriginal.size()); - if (outDecoded.size() != inOriginal.size()) { // Unlikely in normal situation - // Do such check since we will directly access the memory inside outDecoded following - LOGE("[FBSchema][Is] Resize=%zu fail, OOM.", inOriginal.size()); - return false; - } - auto decodeBuf = reinterpret_cast(outDecoded.data()); // changeable buffer - int decodeLen = b64_pton(inOriginal.c_str(), decodeBuf, outDecoded.size()); - LOGD("[FBSchema][Is] Base64 decodeLen=%d, oriLen=%zu.", decodeLen, inOriginal.size()); - if (decodeLen <= 0 || decodeLen >= static_cast(inOriginal.size())) { - outDecoded.clear(); - return false; - } - // Base64 decode success! It should be an encode form of flatBuffer-Schema. - outDecoded.erase(outDecoded.begin() + decodeLen, outDecoded.end()); // Erase surplus space - auto decodeSchemaBuf = reinterpret_cast(outDecoded.c_str()); // Reget the memory after erase. - flatbuffers::Verifier decodeVerifier(decodeSchemaBuf, outDecoded.size()); - if (reflection::VerifySizePrefixedSchemaBuffer(decodeVerifier)) { - return true; - } - LOGE("[FBSchema][Is] Base64 decode success but verify fail."); + outDecoded.clear(); return false; } diff --git a/services/distributeddataservice/libs/distributeddb/include/types_export.h b/services/distributeddataservice/libs/distributeddb/include/types_export.h index 76e948904..b8063b1f3 100755 --- a/services/distributeddataservice/libs/distributeddb/include/types_export.h +++ b/services/distributeddataservice/libs/distributeddb/include/types_export.h @@ -150,12 +150,6 @@ struct SecurityOption { { return securityLabel == rhs.securityLabel && securityFlag == rhs.securityFlag; } - - void operator=(const SecurityOption &rhs) - { - securityLabel = rhs.securityLabel; - securityFlag = rhs.securityFlag; - } }; } // namespace DistributedDB -- Gitee