Skip to content

Commit

Permalink
fix clang warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bastidest committed Nov 5, 2023
1 parent 52a0e6c commit 4adbbef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ project(jess)
include(CTest)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

Expand Down
27 changes: 13 additions & 14 deletions src/NcWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,19 @@ class NcWindow {
[[nodiscard]] size_t cursorPosX() const { return getcurx(handle.get()); }
void setKeypad(bool bEnable) { NC_CHECK_RC(::keypad(handle.get(), bEnable)); }
void move(size_t uPosY, size_t uPosX) { NC_CHECK_RC(::wmove(handle.get(), uPosY, uPosX)); }
template <typename... Args> void printw(const char *formatStr, Args... args) {
NC_CHECK_RC(::wprintw(handle.get(), formatStr, std::forward<Args>(args)...));

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
void printw(const char *formatStr, auto... args) {
NC_CHECK_RC(::wprintw(handle.get(), formatStr, std::forward<decltype(args)>(args)...));
}
#pragma clang diagnostic pop

void clear() { NC_CHECK_RC(::wclear(handle.get())); }
void clearToEol() {
// if(cursorPosX() + 10 >= width()) {
// return;
// }
// if(cursorPosX() + 10 >= width()) {
// return;
// }
::wclrtoeol(handle.get());
}
void clearToBot() { NC_CHECK_RC(::wclrtobot(handle.get())); }
Expand All @@ -59,15 +64,9 @@ class NcWindow {
ret.resize(uActualLength);
return ret;
}
void setNodelay(bool bNodelay) {
::nodelay(handle.get(), bNodelay);
}
void enableAttributes(int attributes) {
NC_CHECK_RC(::wattron(handle.get(), attributes));
}
void disableAttributes(int attributes) {
NC_CHECK_RC(::wattroff(handle.get(), attributes));
}
void setNodelay(bool bNodelay) { ::nodelay(handle.get(), bNodelay); }
void enableAttributes(int attributes) { NC_CHECK_RC(::wattron(handle.get(), attributes)); }
void disableAttributes(int attributes) { NC_CHECK_RC(::wattroff(handle.get(), attributes)); }
};

} // namespace jess

0 comments on commit 4adbbef

Please sign in to comment.