]> gitweb.hhaalo.de Git - mv_none_space.git/commitdiff
fix compare issues
authorBastian Dehn <hhaalo@arcor.de>
Fri, 10 Oct 2025 07:28:36 +0000 (09:28 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 10 Oct 2025 07:28:36 +0000 (09:28 +0200)
CMakeLists.txt
src/main.c
src/rename.c
src/rename.h

index 2eeb49251b90a02285cf296600401c76c9033d02..cd12487bc92973dec0db7cd1538618e92e06c635 100644 (file)
@@ -1,9 +1,9 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1)
 
 IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
-       SET(CMAKE_C_FLAGS "-std=c99 -Werror")
+       SET(CMAKE_C_FLAGS "-std=c99 -Werror -Wextra -pedantic")
 ELSE()
-       SET(CMAKE_C_FLAGS "-std=c99 -g -Wall -fsanitize=address")
+       SET(CMAKE_C_FLAGS "-std=c99 -g -Wall -Wextra -pedantic -fsanitize=address")
 ENDIF()
 MESSAGE(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
 
index 3fd4b370511721286314512e54b0a8b34b1a14b1..3ffa76484140ad093166d4389fa856c9695ccf06 100644 (file)
@@ -48,7 +48,7 @@ void rename_files(const char* dir_path, rename_ptr renamefunc)
        char* dirname = NULL;
        glob_t* files = get_files(dir_path);
 
-       for (int i = 0; i < files->gl_pathc; i++) {
+       for (size_t i = 0; i < files->gl_pathc; i++) {
                output = renamefunc(files->gl_pathv[i]);
                rename_file(files->gl_pathv[i], output);
 
index 7fe12a0fb2872b1767e46374065f91f5ab9afca0..dcfad4e063757316c00e381331495349aa6d2e3c 100644 (file)
@@ -9,7 +9,7 @@ char* escape(const char* src)
        char* dest = malloc(sizeof(char) * STR_MAX_LENGTH);
        int destcounter = 0;
 
-       for (int i = 0; i < length; i++) {
+       for (size_t i = 0; i < length; i++) {
                switch(src[i]) {
                case SPACE:
                case ROUND_BRACKET_OPEN:
@@ -40,7 +40,7 @@ char* rename_point(const char* src)
 
        size_t length = strlen(dest);
        int point_count = 0;
-       for (int i = length - 1; i > -1; i--) {
+       for (size_t i = length - 1; i > 0; i--) {
                if (dest[i] == POINT)
                        point_count++;
 
@@ -58,7 +58,7 @@ char* rename_lower(const char* src)
 {
        char* dest = rename_string(src);
        size_t length = strlen(dest);
-       for (int i = 0; i < length; i++) {
+       for (size_t i = 0; i < length; i++) {
                if (dest[i] >= A && dest[i] <= Z)
                        dest[i] += SPACE;
        }
@@ -72,7 +72,7 @@ char* rename_string(const char* src)
        int dest_count = 0;
        char* dest = malloc(sizeof(char) * STR_MAX_LENGTH);
 
-       for (int i = 0; i < length; i++) {
+       for (size_t i = 0; i < length; i++) {
                if (src[i] == SPACE) {
                        dest[dest_count++] = '_';
                } else if (src[i] == WIDE_CHAR_PREFIX && src[i + 1] == WIDE_CHAR_a) {
index 490324a8c900065b35ab5e050670e4d2807b2707..1378b5336bd5b1e22f02eb0017b3e3c76504316d 100644 (file)
@@ -3,32 +3,32 @@
 
 #define STR_MAX_LENGTH 1024
 
-#define SPACE 0x20
-#define ROUND_BRACKET_OPEN 0x28
-#define ROUND_BRACKET_CLOSE 0x29
-#define BRACKET_OPEN 0x5b
-#define BRACKET_CLOSE 0x5d
-#define BRACE_OPEN 0x7b
-#define BRACE_CLOSE 0x7d
-#define POINT 0x2e
-#define A 0x41
-#define Z 0x5a
-#define WIDE_CHAR_PREFIX 0xffffffc3
-#define WIDE_CHAR_a 0xffffffa4
-#define WIDE_CHAR_A 0xffffff84
-#define WIDE_CHAR_o 0xffffffb6
-#define WIDE_CHAR_O 0xffffff96
-#define WIDE_CHAR_u 0xffffffbc
-#define WIDE_CHAR_U 0xffffff9c
-#define WIDE_CHAR_SS 0xffffff9f
-#define WIDE_CHAR_SHORT_PREFIX 0xc3
-#define WIDE_CHAR_SHORT_a 0xa4
-#define WIDE_CHAR_SHORT_A 0x84
-#define WIDE_CHAR_SHORT_o 0xb6
-#define WIDE_CHAR_SHORT_O 0x96
-#define WIDE_CHAR_SHORT_u 0xbc
-#define WIDE_CHAR_SHORT_U 0x9c
-#define WIDE_CHAR_SHORT_SS 0x9f
+#define SPACE (char) 0x20
+#define ROUND_BRACKET_OPEN (char) 0x28
+#define ROUND_BRACKET_CLOSE (char) 0x29
+#define BRACKET_OPEN (char) 0x5b
+#define BRACKET_CLOSE (char) 0x5d
+#define BRACE_OPEN (char) 0x7b
+#define BRACE_CLOSE (char) 0x7d
+#define POINT (char) 0x2e
+#define A (char) 0x41
+#define Z (char) 0x5a
+#define WIDE_CHAR_PREFIX (char) 0xc3
+#define WIDE_CHAR_a (char) 0xa4
+#define WIDE_CHAR_A (char) 0x84
+#define WIDE_CHAR_o (char) 0xb6
+#define WIDE_CHAR_O (char) 0x96
+#define WIDE_CHAR_u (char) 0xbc
+#define WIDE_CHAR_U (char) 0x9c
+#define WIDE_CHAR_SS (char) 0x9f
+#define WIDE_CHAR_SHORT_PREFIX (char) 0xc3
+#define WIDE_CHAR_SHORT_a (char) 0xa4
+#define WIDE_CHAR_SHORT_A (char) 0x84
+#define WIDE_CHAR_SHORT_o (char) 0xb6
+#define WIDE_CHAR_SHORT_O (char) 0x96
+#define WIDE_CHAR_SHORT_u (char) 0xbc
+#define WIDE_CHAR_SHORT_U (char) 0x9c
+#define WIDE_CHAR_SHORT_SS (char) 0x9f
 
 typedef char* (*rename_ptr)(const char* src);