mirror of
https://github.com/mtheall/ftpd.git
synced 2024-11-23 01:29:51 +00:00
Stricter warnings
This commit is contained in:
parent
55ea4f6201
commit
5c2af6fd29
2
.gitignore
vendored
2
.gitignore
vendored
@ -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*/
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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_);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
int main (int argc_, char *argv_[])
|
||||
int main ()
|
||||
{
|
||||
#ifndef CLASSIC
|
||||
curl_global_init (CURL_GLOBAL_ALL);
|
||||
|
@ -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<struct sockaddr_in const *> (&m_addr)->sin_addr);
|
||||
#else
|
||||
return inet_ntop (AF_INET,
|
||||
|
@ -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
|
||||
|
@ -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<std::uintptr_t> (cmd.TextureId);
|
||||
|
@ -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);
|
||||
|
@ -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 ());
|
||||
|
Loading…
Reference in New Issue
Block a user