diff --git a/.gitignore b/.gitignore index 2b1276b..70a1970 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ *.nso *.pfs0 *.smdh +*~ .gdb_history 3ds/build 3ds-classic/build @@ -23,3 +24,4 @@ switch/build switch-classic/build switch/romfs/*.zst switch/romfs/shaders/*.dksh +build*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e00f77..d529a3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,14 +15,17 @@ target_compile_features(${FTPD_TARGET} PRIVATE cxx_std_20) target_include_directories(${FTPD_TARGET} PRIVATE include) target_compile_definitions(${FTPD_TARGET} PRIVATE STATUS_STRING="${PROJECT_NAME} v${PROJECT_VERSION}" + IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1 ) +target_compile_options(${FTPD_TARGET} PRIVATE -Wall -Wextra -Werror) + include(CheckIPOSupported) check_ipo_supported(RESULT IPO_SUPPORTED) if(IPO_SUPPORTED) set_target_properties(${FTPD_TARGET} PROPERTIES - INTERPROCEDURAL_OPTIMIZATION FALSE + INTERPROCEDURAL_OPTIMIZATION TRUE INTERPROCEDURAL_OPTIMIZATION_DEBUG FALSE INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE diff --git a/source/3ds/platform.cpp b/source/3ds/platform.cpp index d223ee5..833e8eb 100644 --- a/source/3ds/platform.cpp +++ b/source/3ds/platform.cpp @@ -144,6 +144,8 @@ void enableBacklight (bool const enable_) /// \param param_ User param void handleAPTHook (APT_HookType const type_, void *const param_) { + (void)param_; + switch (type_) { case APTHOOK_ONSUSPEND: diff --git a/source/ftpServer.cpp b/source/ftpServer.cpp index e037e48..50d8091 100644 --- a/source/ftpServer.cpp +++ b/source/ftpServer.cpp @@ -99,6 +99,7 @@ int curlDebug (CURL *const handle_, std::size_t const size_, void *const user_) { + (void)handle_; (void)user_; auto const text = printable (data_, size_); diff --git a/source/ftpSession.cpp b/source/ftpSession.cpp index 2cf7435..9c090a3 100644 --- a/source/ftpSession.cpp +++ b/source/ftpSession.cpp @@ -1723,7 +1723,6 @@ bool FtpSession::listTransfer () if (::lstat (fullPath.c_str (), &st) != 0) { error ("Skipping %s: %s\n", fullPath.c_str (), std::strerror (errno)); - std::fprintf (stderr, "Skipping %s: %s\n", fullPath.c_str (), std::strerror (errno)); continue; // just skip it } #ifdef __3DS__ @@ -1867,6 +1866,8 @@ bool FtpSession::storeTransfer () /////////////////////////////////////////////////////////////////////////// void FtpSession::ABOR (char const *args_) { + (void)args_; + if (m_state == State::COMMAND) { sendResponse ("225 No transfer to abort\r\n"); @@ -1881,6 +1882,8 @@ void FtpSession::ABOR (char const *args_) void FtpSession::ALLO (char const *args_) { + (void)args_; + sendResponse ("202 Superfluous command\r\n"); setState (State::COMMAND, false, false); } @@ -1900,6 +1903,8 @@ void FtpSession::APPE (char const *args_) void FtpSession::CDUP (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); if (!authorized ()) @@ -1966,6 +1971,8 @@ void FtpSession::DELE (char const *args_) } void FtpSession::FEAT (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); sendResponse ("211-\r\n" " MDTM\r\n" @@ -1985,6 +1992,8 @@ void FtpSession::FEAT (char const *args_) void FtpSession::HELP (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); sendResponse ("214-\r\n" "The following commands are recognized\r\n" @@ -2009,6 +2018,8 @@ void FtpSession::LIST (char const *args_) void FtpSession::MDTM (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); if (!authorized ()) @@ -2104,6 +2115,8 @@ void FtpSession::NLST (char const *args_) void FtpSession::NOOP (char const *args_) { + (void)args_; + sendResponse ("200 OK\r\n"); } @@ -2201,6 +2214,8 @@ void FtpSession::PASS (char const *args_) void FtpSession::PASV (char const *args_) { + (void)args_; + if (!authorized ()) { setState (State::COMMAND, false, false); @@ -2364,6 +2379,8 @@ void FtpSession::PORT (char const *args_) void FtpSession::PWD (char const *args_) { + (void)args_; + if (!authorized ()) { sendResponse ("530 Not logged in\r\n"); @@ -2381,6 +2398,8 @@ void FtpSession::PWD (char const *args_) void FtpSession::QUIT (char const *args_) { + (void)args_; + sendResponse ("221 Disconnecting\r\n"); closeCommand (); } @@ -2756,6 +2775,8 @@ void FtpSession::STOR (char const *args_) void FtpSession::STOU (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); sendResponse ("502 Command not implemented\r\n"); } @@ -2776,12 +2797,16 @@ void FtpSession::STRU (char const *args_) void FtpSession::SYST (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); sendResponse ("215 UNIX Type: L8\r\n"); } void FtpSession::TYPE (char const *args_) { + (void)args_; + setState (State::COMMAND, false, false); // we always transfer in binary mode diff --git a/source/log.cpp b/source/log.cpp index 95fe1c8..1581b54 100644 --- a/source/log.cpp +++ b/source/log.cpp @@ -191,6 +191,8 @@ void debug (char const *const fmt_, ...) va_start (ap, fmt_); addLog (DEBUG, fmt_, ap); va_end (ap); +#else + (void)fmt_; #endif } diff --git a/source/main.cpp b/source/main.cpp index f7f098c..3703a16 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -3,7 +3,7 @@ // - RFC 3659 (https://tools.ietf.org/html/rfc3659) // - suggested implementation details from https://cr.yp.to/ftp/filesystem.html // -// Copyright (C) 2022 Michael Theall +// Copyright (C) 2023 Michael Theall // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ #include #include -int main (int argc_, char *argv_[]) +int main () { #ifndef CLASSIC curl_global_init (CURL_GLOBAL_ALL); diff --git a/source/sockAddr.cpp b/source/sockAddr.cpp index f5c8544..558ab75 100644 --- a/source/sockAddr.cpp +++ b/source/sockAddr.cpp @@ -151,6 +151,8 @@ char const *SockAddr::name (char *buffer_, std::size_t size_) const { case AF_INET: #ifdef __NDS__ + (void)buffer_; + (void)size_; return inet_ntoa (reinterpret_cast (&m_addr)->sin_addr); #else return inet_ntop (AF_INET, diff --git a/source/socket.cpp b/source/socket.cpp index 85a4cea..42fd018 100644 --- a/source/socket.cpp +++ b/source/socket.cpp @@ -181,6 +181,8 @@ bool Socket::shutdown (int const how_) bool Socket::setLinger (bool const enable_, std::chrono::seconds const time_) { #ifdef __NDS__ + (void)enable_; + (void)time_; errno = ENOSYS; return -1; #else diff --git a/source/switch/imgui_deko3d.cpp b/source/switch/imgui_deko3d.cpp index 8946cb8..b98ce8a 100644 --- a/source/switch/imgui_deko3d.cpp +++ b/source/switch/imgui_deko3d.cpp @@ -5,7 +5,7 @@ // // The MIT License (MIT) // -// Copyright (C) 2020 Michael Theall +// Copyright (C) 2023 Michael Theall // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -210,7 +210,7 @@ DkCmdList setupRenderState (dk::UniqueCmdBuf &cmdBuf_, vertUBO.projMtx = glm::orthoRH_ZO (L, R, B, T, -1.0f, 1.0f); // create command buffer to initialize/reset render state - cmdBuf_.setViewports (0, DkViewport{0.0f, 0.0f, width_, height_}); + cmdBuf_.setViewports (0, DkViewport{0.0f, 0.0f, (float)width_, (float)height_, 0.0f, 0.0f}); cmdBuf_.bindShaders (DkStageFlag_GraphicsMask, {&s_shaders[0], &s_shaders[1]}); cmdBuf_.bindUniformBuffer (DkStage_Vertex, 0, @@ -328,7 +328,9 @@ void imgui::deko3d::init (dk::UniqueDevice &device_, // copy font texture atlas to image view dk::ImageView imageView{fontTexture}; - cmdBuf_.copyBufferToImage ({memBlock.getGpuAddr ()}, imageView, {0, 0, 0, width, height, 1}); + cmdBuf_.copyBufferToImage ({memBlock.getGpuAddr (), 0, 0}, + imageView, + {0, 0, 0, (unsigned int)width, (unsigned int)height, 1}); // submit commands to transfer font texture queue_.submitCommands (cmdBuf_.finishList ()); @@ -487,8 +489,11 @@ void imgui::deko3d::render (dk::UniqueDevice &device_, clip.w = height; // apply scissor boundaries - cmdBuf_.setScissors ( - 0, DkScissor{clip.x, clip.y, clip.z - clip.x, clip.w - clip.y}); + cmdBuf_.setScissors (0, + DkScissor{(unsigned int)clip.x, + (unsigned int)clip.y, + (unsigned int)(clip.z - clip.x), + (unsigned int)(clip.w - clip.y)}); // get texture handle auto const textureHandle = reinterpret_cast (cmd.TextureId); diff --git a/source/switch/imgui_nx.cpp b/source/switch/imgui_nx.cpp index c6e7672..4ea516b 100644 --- a/source/switch/imgui_nx.cpp +++ b/source/switch/imgui_nx.cpp @@ -1357,6 +1357,8 @@ void setClipboardText (void *const userData_, char const *const text_) /// \param force_ Whether to ignore prior mouse position void moveMouse (ImGuiIO &io_, ImVec2 const &pos_, bool const force_ = false) { + (void)io_; + // get update timestamp auto const now = std::chrono::steady_clock::now (); @@ -1606,14 +1608,14 @@ bool imgui::nx::init () auto rc = setInitialize (); if (R_FAILED (rc)) { - std::fprintf (stderr, "setInitialize: 0x%lx\n", rc); + std::fprintf (stderr, "setInitialize: 0x%x\n", rc); return false; } rc = setGetSystemLanguage (&languageCode); if (R_FAILED (rc)) { - std::fprintf (stderr, "setGetSystemLanguage: 0x%lx\n", rc); + std::fprintf (stderr, "setGetSystemLanguage: 0x%x\n", rc); setExit (); return false; } @@ -1625,7 +1627,7 @@ bool imgui::nx::init () rc = plGetSharedFont (languageCode, fonts.data (), fonts.size (), &numFonts); if (R_FAILED (rc)) { - std::fprintf (stderr, "plGetSharedFont: 0x%lx\n", rc); + std::fprintf (stderr, "plGetSharedFont: 0x%x\n", rc); return false; } fonts.resize (numFonts); diff --git a/source/switch/platform.cpp b/source/switch/platform.cpp index b29d4c9..86ca283 100644 --- a/source/switch/platform.cpp +++ b/source/switch/platform.cpp @@ -402,7 +402,7 @@ void loadTextures () // copy texture to image dk::ImageView imageView (image); - cmdBuf.copyBufferToImage ({memBlock.getGpuAddr ()}, + cmdBuf.copyBufferToImage ({memBlock.getGpuAddr (), 0, 0}, imageView, {0, 0, 0, textureInfo.width, textureInfo.height, 1}); s_queue.submitCommands (cmdBuf.finishList ());