diff --git a/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h b/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h index 50137d38a9f3bf24100a482b53ca586d9c82257d..63da7d5de20e8be76053990ddf17654d0c90b9c0 100644 --- a/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h +++ b/frameworks/libs/distributeddb/interfaces/include/cloud/cloud_store_types.h @@ -145,7 +145,7 @@ enum class LockAction : uint32_t { DOWNLOAD = 0x8 }; -enum CloudSyncState { +enum class CloudSyncState : uint8_t { IDLE = 0, DO_DOWNLOAD, DO_UPLOAD, @@ -153,7 +153,7 @@ enum CloudSyncState { DO_FINISHED }; -enum CloudSyncEvent { +enum class CloudSyncEvent : uint8_t { UPLOAD_FINISHED_EVENT, DOWNLOAD_FINISHED_EVENT, ERROR_EVENT, diff --git a/frameworks/libs/distributeddb/interfaces/src/relational/knowledge_source_utils.h b/frameworks/libs/distributeddb/interfaces/src/relational/knowledge_source_utils.h index 7e8beaf831ff87a4b803304e23509afc739c241f..44e6be6761cbe89ab74c062b3926f700d0734d07 100644 --- a/frameworks/libs/distributeddb/interfaces/src/relational/knowledge_source_utils.h +++ b/frameworks/libs/distributeddb/interfaces/src/relational/knowledge_source_utils.h @@ -16,6 +16,10 @@ #ifndef KNOWLEDGE_SOURCE_UTILS_H #define KNOWLEDGE_SOURCE_UTILS_H +#include +#include +#include + #include "relational_schema_object.h" #include "relational_store_client.h" diff --git a/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_single_ver_natural_store_connection.cpp b/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_single_ver_natural_store_connection.cpp index 2c43b9c3d369deac84cea81cf3db5078ccd257ce..c5cf5bbb114a42f05966110161aacdf23e9b1e17 100755 --- a/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_single_ver_natural_store_connection.cpp +++ b/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_single_ver_natural_store_connection.cpp @@ -465,6 +465,7 @@ int RdSingleVerNaturalStoreConnection::RegisterLifeCycleCallback(const DatabaseL // Called when Close and delete the connection. int RdSingleVerNaturalStoreConnection::PreClose(bool isCloseImmediately) { + (void)isCloseImmediately; // check if result set closed std::lock_guard lock(kvDbResultSetsMutex_); if (kvDbResultSets_.size() > 0) { diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/relational/device_tracker_log_table_manager.h b/frameworks/libs/distributeddb/storage/src/sqlite/relational/device_tracker_log_table_manager.h index 7b237da9574e74fe3ab063a3c665666e6874a8ee..f0c1269c29b21cc2a0d21b17e2fd80192caa9246 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/relational/device_tracker_log_table_manager.h +++ b/frameworks/libs/distributeddb/storage/src/sqlite/relational/device_tracker_log_table_manager.h @@ -16,6 +16,8 @@ #ifndef DEVICE_TRACKER_LOG_TABLE_MANAGER_H #define DEVICE_TRACKER_LOG_TABLE_MANAGER_H + #include + #include "sqlite_log_table_manager.h" namespace DistributedDB { diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_sync_state_machine.cpp b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_sync_state_machine.cpp index b080e2b683d920869e0890b633ede9171e31109d..96df3ee92231800da3e8338dff52e7d0b93034ab 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_sync_state_machine.cpp +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_sync_state_machine.cpp @@ -32,25 +32,35 @@ namespace { constexpr int OUTPUT_STATE_INDEX = 2; const std::vector> STATE_SWITCH_TABLE = { - // In IDEL state - {State::IDLE, Event::START_SYNC_EVENT, State::DO_DOWNLOAD}, - {State::IDLE, Event::ERROR_EVENT, State::DO_FINISHED}, + // In IDLE state + {static_cast(State::IDLE), static_cast(Event::START_SYNC_EVENT), + static_cast(State::DO_DOWNLOAD)}, + {static_cast(State::IDLE), static_cast(Event::ERROR_EVENT), + static_cast(State::DO_FINISHED)}, // In DO_DOWNLOAD state - {State::DO_DOWNLOAD, Event::DOWNLOAD_FINISHED_EVENT, State::DO_UPLOAD}, - {State::DO_DOWNLOAD, Event::ERROR_EVENT, State::DO_FINISHED}, + {static_cast(State::DO_DOWNLOAD), static_cast(Event::DOWNLOAD_FINISHED_EVENT), + static_cast(State::DO_UPLOAD)}, + {static_cast(State::DO_DOWNLOAD), static_cast(Event::ERROR_EVENT), + static_cast(State::DO_FINISHED)}, // In DO_UPLOAD state - {State::DO_UPLOAD, Event::UPLOAD_FINISHED_EVENT, State::DO_FINISHED}, - {State::DO_UPLOAD, Event::ERROR_EVENT, State::DO_FINISHED}, - {State::DO_UPLOAD, Event::REPEAT_CHECK_EVENT, State::DO_REPEAT_CHECK}, + {static_cast(State::DO_UPLOAD), static_cast(Event::UPLOAD_FINISHED_EVENT), + static_cast(State::DO_FINISHED)}, + {static_cast(State::DO_UPLOAD), static_cast(Event::ERROR_EVENT), + static_cast(State::DO_FINISHED)}, + {static_cast(State::DO_UPLOAD), static_cast(Event::REPEAT_CHECK_EVENT), + static_cast(State::DO_REPEAT_CHECK)}, // Repeat download check state - {State::DO_REPEAT_CHECK, Event::REPEAT_DOWNLOAD_EVENT, State::DO_DOWNLOAD}, - {State::DO_REPEAT_CHECK, Event::ERROR_EVENT, State::DO_FINISHED}, + {static_cast(State::DO_REPEAT_CHECK), static_cast(Event::REPEAT_DOWNLOAD_EVENT), + static_cast(State::DO_DOWNLOAD)}, + {static_cast(State::DO_REPEAT_CHECK), static_cast(Event::ERROR_EVENT), + static_cast(State::DO_FINISHED)}, // In DO_FINISHED state - {State::DO_FINISHED, Event::ALL_TASK_FINISHED_EVENT, State::IDLE}, + {static_cast(State::DO_FINISHED), static_cast(Event::ALL_TASK_FINISHED_EVENT), + static_cast(State::IDLE)}, }; } @@ -68,14 +78,14 @@ void CloudSyncStateMachine::SyncStep() { Event event = Event::ERROR_EVENT; do { - auto iter = stateMapping_.find(currentState_); + auto iter = stateMapping_.find(static_cast(currentState_)); if (iter != stateMapping_.end()) { event = static_cast(iter->second()); } else { LOGE("[CloudSyncStateMachine][SyncStep] can not find state=%d", currentState_); break; } - } while (SwitchMachineState(event) == E_OK && currentState_ != State::IDLE); + } while (SwitchMachineState(static_cast(event)) == E_OK && currentState_ != State::IDLE); } void CloudSyncStateMachine::InitCloudStateSwitchTables() @@ -116,7 +126,7 @@ void CloudSyncStateMachine::InitCloudStateSwitchTable( void CloudSyncStateMachine::RegisterFunc(State state, const std::function &function) { - stateMapping_[state] = function; + stateMapping_[static_cast(state)] = function; }; int CloudSyncStateMachine::SwitchMachineState(uint8_t event) @@ -131,7 +141,7 @@ int CloudSyncStateMachine::SwitchMachineState(uint8_t event) } const std::map &table = (*tableIter).switchTable; - auto eventToStateIter = table.find(currentState_); + auto eventToStateIter = table.find(static_cast(currentState_)); if (eventToStateIter == table.end()) { LOGE("[CloudSyncStateMachine][SwitchState] Can't find EventToState with currentSate %u", currentState_); diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp index 7a774ae1ca5433462e537f87077c22ce2f370333..e28c31e31025dd1effd79a12310220c80637b6b4 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp @@ -447,7 +447,7 @@ CloudSyncEvent CloudSyncer::SyncMachineDoFinished() int CloudSyncer::DoSyncInner(const CloudTaskInfo &taskInfo) { - cloudSyncStateMachine_.SwitchStateAndStep(CloudSyncEvent::START_SYNC_EVENT); + cloudSyncStateMachine_.SwitchStateAndStep(static_cast(CloudSyncEvent::START_SYNC_EVENT)); DBDfxAdapter::ReportBehavior( {__func__, Scene::CLOUD_SYNC, State::BEGIN, Stage::CLOUD_SYNC, StageResult::SUCC, E_OK}); return E_OK; diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp index 336a76086cedbc42a79e82152d6d2db556a7a9f4..4126ba59786908a8447bc6d29f4d20f81ebaa90a 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp @@ -1248,16 +1248,16 @@ void CloudSyncer::InitCloudSyncStateMachine() { CloudSyncStateMachine::Initialize(); cloudSyncStateMachine_.RegisterFunc(CloudSyncState::DO_DOWNLOAD, [this]() { - return SyncMachineDoDownload(); + return static_cast(SyncMachineDoDownload()); }); cloudSyncStateMachine_.RegisterFunc(CloudSyncState::DO_UPLOAD, [this]() { - return SyncMachineDoUpload(); + return static_cast(SyncMachineDoUpload()); }); cloudSyncStateMachine_.RegisterFunc(CloudSyncState::DO_FINISHED, [this]() { - return SyncMachineDoFinished(); + return static_cast(SyncMachineDoFinished()); }); cloudSyncStateMachine_.RegisterFunc(CloudSyncState::DO_REPEAT_CHECK, [this]() { - return SyncMachineDoRepeatCheck(); + return static_cast(SyncMachineDoRepeatCheck()); }); } diff --git a/frameworks/libs/distributeddb/syncer/src/device/singlever/single_ver_sync_task_context.h b/frameworks/libs/distributeddb/syncer/src/device/singlever/single_ver_sync_task_context.h index 0b17046c18ac8d9a1e634cab975621217538f74f..1dfb454032ea624e6c59aaccbba190946e71332d 100644 --- a/frameworks/libs/distributeddb/syncer/src/device/singlever/single_ver_sync_task_context.h +++ b/frameworks/libs/distributeddb/syncer/src/device/singlever/single_ver_sync_task_context.h @@ -16,6 +16,7 @@ #ifndef SINGLE_VER_SYNC_TASK_CONTEXT_H #define SINGLE_VER_SYNC_TASK_CONTEXT_H +#include #include #include #include