From 5871a87dbdc6adbeacc3d2b5a8e4b4bfff9cab6c Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 29 Jun 2024 14:43:19 +0300 Subject: [PATCH] fixed --- Makefile | 2 +- plainbin.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fc9c737..47288b2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS?=-pedantic -O0 -s -Wall +CFLAGS?=-pedantic -O3 -s -Wall -Wextra CC?=cc all: diff --git a/plainbin.c b/plainbin.c index 68c156b..f0dcd53 100644 --- a/plainbin.c +++ b/plainbin.c @@ -29,10 +29,10 @@ char *dir = "."; char *prog_name; int ifd; -int ifd_clients; +size_t ifd_clients; int ofd; -int ofd_clients; +size_t ofd_clients; enum { OUTPUT, @@ -85,7 +85,7 @@ char *rand_string(void) { if (res == NULL) return NULL; - for (int i = 0; i < name_len; i++) + for (size_t i = 0; i < name_len; i++) res[i] = abc[rand() % (sizeof(abc) - 1)]; res[name_len] = '\0'; @@ -158,7 +158,7 @@ void upload(int cfd, pid_t par) { break; tbytes += rbytes; - if (tbytes / 1024 / 1024 >= max_size) { + if (tbytes / 1024 / 1024 >= (ssize_t)max_size) { send_str(cfd, MSG2, sizeof(MSG2), WRITE); break; }