diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ac15a783..688328823 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,7 +364,7 @@ set(LIBFASTFETCH_SRC src/common/library.c src/common/modules.c src/common/netif/netif.c - src/common/networking_common.c + src/common/networking/networking_common.c src/common/option.c src/common/parsing.c src/common/printing.c @@ -493,7 +493,7 @@ if(LINUX) src/common/dbus.c src/common/io/io_unix.c src/common/netif/netif_linux.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/detection/battery/battery_linux.c src/detection/bios/bios_linux.c @@ -574,7 +574,7 @@ elseif(ANDROID) list(APPEND LIBFASTFETCH_SRC src/common/io/io_unix.c src/common/netif/netif_linux.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/detection/battery/battery_android.c src/detection/bios/bios_android.c @@ -640,7 +640,7 @@ elseif(FreeBSD) src/common/dbus.c src/common/io/io_unix.c src/common/netif/netif_bsd.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/common/sysctl.c src/detection/battery/battery_bsd.c @@ -731,7 +731,7 @@ elseif(NetBSD) src/common/dbus.c src/common/io/io_unix.c src/common/netif/netif_bsd.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/common/sysctl.c src/detection/battery/battery_nbsd.c @@ -813,7 +813,7 @@ elseif(OpenBSD) src/common/dbus.c src/common/io/io_unix.c src/common/netif/netif_bsd.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/common/sysctl.c src/detection/battery/battery_obsd.c @@ -894,7 +894,7 @@ elseif(APPLE) list(APPEND LIBFASTFETCH_SRC src/common/io/io_unix.c src/common/netif/netif_bsd.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/common/sysctl.c src/detection/battery/battery_apple.c @@ -965,7 +965,7 @@ elseif(WIN32) list(APPEND LIBFASTFETCH_SRC src/common/io/io_windows.c src/common/netif/netif_windows.c - src/common/networking_windows.c + src/common/networking/networking_windows.c src/common/processing_windows.c src/detection/battery/battery_windows.c src/detection/bios/bios_windows.c @@ -1040,7 +1040,7 @@ elseif(SunOS) src/common/dbus.c src/common/io/io_unix.c src/common/netif/netif_bsd.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/detection/battery/battery_nosupport.c src/detection/bios/bios_windows.c @@ -1121,7 +1121,7 @@ elseif(Haiku) src/common/dbus.c src/common/io/io_unix.c src/common/netif/netif_haiku.c - src/common/networking_linux.c + src/common/networking/networking_linux.c src/common/processing_linux.c src/detection/battery/battery_haiku.c src/detection/bios/bios_windows.c diff --git a/src/common/networking.h b/src/common/networking/networking.h similarity index 100% rename from src/common/networking.h rename to src/common/networking/networking.h diff --git a/src/common/networking_common.c b/src/common/networking/networking_common.c similarity index 99% rename from src/common/networking_common.c rename to src/common/networking/networking_common.c index 769860ff7..2c2de07c7 100644 --- a/src/common/networking_common.c +++ b/src/common/networking/networking_common.c @@ -1,6 +1,6 @@ #include "fastfetch.h" #include "common/library.h" -#include "common/networking.h" +#include "common/networking/networking.h" #include "util/stringUtils.h" #include "util/debug.h" diff --git a/src/common/networking_linux.c b/src/common/networking/networking_linux.c similarity index 98% rename from src/common/networking_linux.c rename to src/common/networking/networking_linux.c index 76ec71dbf..6402e394e 100644 --- a/src/common/networking_linux.c +++ b/src/common/networking/networking_linux.c @@ -1,5 +1,5 @@ #include "fastfetch.h" -#include "common/networking.h" +#include "common/networking/networking.h" #include "common/time.h" #include "common/library.h" #include "util/stringUtils.h" @@ -331,9 +331,8 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf char* headerEnd = NULL; do { - size_t availSpace = ffStrbufGetFree(buffer); - FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %zu", - ++recvCount, buffer->length, availSpace); + FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %u", + ++recvCount, buffer->length, ffStrbufGetFree(buffer)); ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0); diff --git a/src/common/networking_windows.c b/src/common/networking/networking_windows.c similarity index 98% rename from src/common/networking_windows.c rename to src/common/networking/networking_windows.c index 2210c8fea..92ce0375a 100644 --- a/src/common/networking_windows.c +++ b/src/common/networking/networking_windows.c @@ -3,7 +3,7 @@ //Must be included after #include "fastfetch.h" -#include "common/networking.h" +#include "common/networking/networking.h" #include "util/stringUtils.h" #include "util/debug.h" @@ -225,9 +225,8 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf char* headerEnd = NULL; do { - size_t availSpace = ffStrbufGetFree(buffer); - FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %zu", - ++recvCount, buffer->length, availSpace); + FF_DEBUG("Data reception loop #%d, current buffer size: %u, available space: %u", + ++recvCount, buffer->length, ffStrbufGetFree(buffer)); ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int)ffStrbufGetFree(buffer), 0); diff --git a/src/detection/publicip/publicip.c b/src/detection/publicip/publicip.c index aa5f22419..fd5bed232 100644 --- a/src/detection/publicip/publicip.c +++ b/src/detection/publicip/publicip.c @@ -1,5 +1,5 @@ #include "publicip.h" -#include "common/networking.h" +#include "common/networking/networking.h" #define FF_UNITIALIZED ((const char*)(uintptr_t) -1) static FFNetworkingState states[2]; diff --git a/src/detection/weather/weather.c b/src/detection/weather/weather.c index c340db636..8f1a2accb 100644 --- a/src/detection/weather/weather.c +++ b/src/detection/weather/weather.c @@ -1,4 +1,5 @@ #include "weather.h" +#include "common/networking/networking.h" #define FF_UNITIALIZED ((const char*)(uintptr_t) -1) static FFNetworkingState state; diff --git a/src/detection/weather/weather.h b/src/detection/weather/weather.h index 55a578628..24dde33bb 100644 --- a/src/detection/weather/weather.h +++ b/src/detection/weather/weather.h @@ -1,6 +1,6 @@ #pragma once -#include "common/networking.h" +#include "fastfetch.h" void ffPrepareWeather(FFWeatherOptions* options); const char* ffDetectWeather(FFWeatherOptions* options, FFstrbuf* result);