diff --git a/base/include/event.h b/base/include/io_event_common.h similarity index 89% rename from base/include/event.h rename to base/include/io_event_common.h index 4ff670261c2e2756cc9e0b6b3c987163e5966b15..5ae67aafd6262b6162e16c5e26aaa4aeafbf73f1 100644 --- a/base/include/event.h +++ b/base/include/io_event_common.h @@ -16,8 +16,8 @@ #include #include -#ifndef UTILS_EVENT_H -#define UTILS_EVENT_H +#ifndef UTILS_IO_EVENT_COMMON_H +#define UTILS_IO_EVENT_COMMON_H namespace OHOS { namespace Utils { @@ -29,7 +29,7 @@ using REventId = EventId; using EventCallback = std::function; -static constexpr int INVALID_FD = -1; +static constexpr int IO_EVENT_INVALID_FD = -1; namespace Events { @@ -43,4 +43,4 @@ namespace Events { } // namespace Utils } // namespace OHOS -#endif /* UTILS_EVENT_H */ \ No newline at end of file +#endif /* UTILS_IO_EVENT_COMMON_H */ \ No newline at end of file diff --git a/base/include/io_event_handler.h b/base/include/io_event_handler.h index 7b3af32f32704c7595cee5b6ec57dd5eb410a3d1..a5810630befcb825fa3468a9d0572376386c83bc 100644 --- a/base/include/io_event_handler.h +++ b/base/include/io_event_handler.h @@ -17,7 +17,7 @@ #define UTILS_EVENT_HANDLER_H #include "errors.h" -#include "event.h" +#include "io_event_common.h" namespace OHOS { namespace Utils { diff --git a/base/include/io_event_reactor.h b/base/include/io_event_reactor.h index 8bc2fecdc2393ea0f926361c76217c0d0f1007f0..f5d0fb1410b34e728a357ac5587ce478f53e0ddd 100644 --- a/base/include/io_event_reactor.h +++ b/base/include/io_event_reactor.h @@ -23,7 +23,7 @@ #include #include #include -#include "event.h" +#include "io_event_common.h" #include "errors.h" #include "io_event_handler.h" diff --git a/base/src/io_event_epoll.cpp b/base/src/io_event_epoll.cpp index 5b0a4d54c43d1c215c705c065a8069cab0ad5d65..0001d42e6c7f28c3ca3c85ee0e9359bb9fbfbccb 100644 --- a/base/src/io_event_epoll.cpp +++ b/base/src/io_event_epoll.cpp @@ -19,7 +19,7 @@ #include #include #include "utils_log.h" -#include "event.h" +#include "io_event_common.h" #include "common_event_sys_errors.h" #include "io_event_epoll.h" @@ -46,11 +46,11 @@ ErrCode IOEventEpoll::SetUp() void IOEventEpoll::CleanUp() { - if (epollFd_ != INVALID_FD) { + if (epollFd_ != IO_EVENT_INVALID_FD) { if (close(epollFd_) != 0) { UTILS_LOGW("%{public}s: Failed, cannot close fd: %{public}s.", __FUNCTION__, strerror(errno)); } - epollFd_ = INVALID_FD; + epollFd_ = IO_EVENT_INVALID_FD; } } diff --git a/base/src/io_event_epoll.h b/base/src/io_event_epoll.h index 770dc87c2cd4bf8fc2ede5547f09c59a9f112527..5ef4d3bb0a3715ad9d73c8db3d2748d64ac4e36e 100644 --- a/base/src/io_event_epoll.h +++ b/base/src/io_event_epoll.h @@ -20,7 +20,7 @@ #include #include #include -#include "event.h" +#include "io_event_common.h" #include "errors.h" namespace OHOS { diff --git a/base/src/io_event_handler.cpp b/base/src/io_event_handler.cpp index 432ca8011600cc3c81f70ee1f9ffd9cdcadbbf39..f6a12a567a3ec847fcd5cdff5243b767787386dc 100644 --- a/base/src/io_event_handler.cpp +++ b/base/src/io_event_handler.cpp @@ -22,7 +22,7 @@ namespace OHOS { namespace Utils { IOEventHandler::IOEventHandler() - :prev_(nullptr), next_(nullptr), fd_(INVALID_FD), events_(Events::EVENT_NONE), cb_(nullptr), enabled_(false) {} + :prev_(nullptr), next_(nullptr), fd_(IO_EVENT_INVALID_FD), events_(Events::EVENT_NONE), cb_(nullptr), enabled_(false) {} IOEventHandler::IOEventHandler(int fd, EventId events, const EventCallback& cb) :prev_(nullptr), next_(nullptr), fd_(fd), events_(events), cb_(cb), enabled_(false) {}