From d1311b27e8d3b10f1b9ccff8b0bae87162ba4e3e Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Thu, 10 Oct 2024 23:00:52 -0700 Subject: [PATCH] workaround clang LSP warnings & errors --- src/json.c | 2 +- src/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/json.c b/src/json.c index 0b0c15a..7f43773 100644 --- a/src/json.c +++ b/src/json.c @@ -16,7 +16,7 @@ int createDirectory(const char *dir_name) { // check if directory already exists struct stat statbuf; - if (stat(dir_name, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) + if (stat(dir_name, &statbuf) == 0 && (statbuf.st_mode & S_IFMT) == S_IFDIR) return 0; // Directory exists if (MKDIR(dir_name) == 0) { diff --git a/src/main.c b/src/main.c index 0109d26..b027f61 100644 --- a/src/main.c +++ b/src/main.c @@ -49,8 +49,8 @@ uint8_t *equal(uint8_t *arr, size_t size) { TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *courses, size_t size_courses) { TIMETABLE timetable = {{{{0}}}, false}; - uint8_t MEDIAN = floor((MIN_REQ + CLASS_CAP) / 2); - uint8_t BLOCKS_PER_SEMESTER = TOTAL_BLOCKS / 2; + uint8_t MEDIAN = floor((float) (MIN_REQ + CLASS_CAP) / 2); + // uint8_t BLOCKS_PER_SEMESTER = TOTAL_BLOCKS / 2; // Step 1 - Tally requests to check which courses are eligable to run @@ -103,7 +103,7 @@ TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *cou size_t currentIndex = 0; for (size_t i = 0; i < activeCourseIndex; i++) { uint16_t index = activeCoursesIndexes[i]; - uint8_t classRunCount = floor(courses[index].requests / MEDIAN); + uint8_t classRunCount = floor((float) courses[index].requests / MEDIAN); uint8_t remaining = courses[index].requests % MEDIAN; size_t *courseClassIndexes = malloc((classRunCount + 1) * sizeof(size_t)); // add 1 to classRunCount in case we need to create an extra class with remaining