diff --git a/common/cpp/src/database/mongodb_client.cpp b/common/cpp/src/database/mongodb_client.cpp index 098cdcf63a6f3a1db4f1ed6acd9359c43e854e40..d57c3a27538c60c84c5b73b52bb799843ce7672a 100644 --- a/common/cpp/src/database/mongodb_client.cpp +++ b/common/cpp/src/database/mongodb_client.cpp @@ -501,8 +501,8 @@ Error MongoDBClient::GetRecordFromDb(const std::string& collection, uint64_t id, } bson_error_t mongo_err; - bson_t* filter; - bson_t* opts; + bson_t* filter{nullptr}; + bson_t* opts{nullptr}; mongoc_cursor_t* cursor; const bson_t* doc; char* str; diff --git a/producer/event_monitor_producer/src/inotify_event.cpp b/producer/event_monitor_producer/src/inotify_event.cpp index f28aa50f89b768e93428db19ba915609154974da..f0deca3de91885db4e999934288ba8566becc4ab 100644 --- a/producer/event_monitor_producer/src/inotify_event.cpp +++ b/producer/event_monitor_producer/src/inotify_event.cpp @@ -2,14 +2,12 @@ namespace asapo { -InotifyEvent::InotifyEvent(const struct inotify_event* inotify_event, - const std::map<int, std::string>& watched_folders_paths): - inotify_event_{inotify_event}, watched_folders_paths_{watched_folders_paths} { - +InotifyEvent::InotifyEvent(const struct inotify_event* inotify_event): + inotify_event_{inotify_event}{ } uint32_t InotifyEvent::Length() const { - return sizeof(struct inotify_event) + static_cast<uint32_t>(inotify_event_->len); + return static_cast<uint32_t>(sizeof(struct inotify_event)) + static_cast<uint32_t>(inotify_event_->len); } bool InotifyEvent::IsDirectoryEvent() const { diff --git a/producer/event_monitor_producer/src/inotify_event.h b/producer/event_monitor_producer/src/inotify_event.h index 9ba0d7ec1e136b8b4d2a6cca234ef364808e91d8..a2cef81aa2e2544c514a36927b1cfae8fc8cdea3 100644 --- a/producer/event_monitor_producer/src/inotify_event.h +++ b/producer/event_monitor_producer/src/inotify_event.h @@ -13,7 +13,7 @@ namespace asapo { class InotifyEvent { public: - InotifyEvent(const struct inotify_event* inotify_event, const std::map<int, std::string>& watched_folders_paths); + InotifyEvent(const struct inotify_event* inotify_event); uint32_t Length() const ; bool IsDirectoryEvent() const ; bool IsNewFileInFolderEvent() const; @@ -26,7 +26,6 @@ class InotifyEvent { void Print() const; private: const struct inotify_event* inotify_event_; - const std::map<int, std::string>& watched_folders_paths_; }; } diff --git a/producer/event_monitor_producer/src/system_folder_watch_linux.cpp b/producer/event_monitor_producer/src/system_folder_watch_linux.cpp index 23f153fdff24d0c392598338fe07fa033ee484cc..31ce158a8ee5d1b376c2a18db0649c5343b70280 100644 --- a/producer/event_monitor_producer/src/system_folder_watch_linux.cpp +++ b/producer/event_monitor_producer/src/system_folder_watch_linux.cpp @@ -210,7 +210,7 @@ Error SystemFolderWatch::ProcessInotifyEvents(int bytes_in_buffer_, FilesToSend* int nerrors = 0; int nevents = 0; for (char* p = buffer_.get(); p < buffer_.get() + bytes_in_buffer_; ) { - InotifyEvent event{(struct inotify_event*) p, watched_folders_paths_}; + InotifyEvent event{(struct inotify_event*) p}; auto err = ProcessInotifyEvent(event, events); if (err) { GetDefaultEventMonLogger()->Error("error processing inotify event: " + err->Explain());