diff --git a/README.md b/README.md index eeabe17..8db5a30 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ## Caesium CommandLineTools -###### caesium-clt - v0.16.0-beta (build 20211023) +###### caesium-clt - v0.17.0-beta (build 20221001) ###### REQUIREMENTS -* [libcaesium](https://github.com/Lymphatus/libcaesium) >= 0.6.0 +* [libcaesium](https://github.com/Lymphatus/libcaesium) >= 0.9.2 ###### Included libraries * [optparse](https://github.com/skeeto/optparse) @@ -11,8 +11,8 @@ ---------- ###### TESTED PLATFORMS -* Mac OS X Big Sur (v10.15) -* Ubuntu 20.04 +* macOS Monterey (v12.6) +* Ubuntu 22.04 * Windows 10 ---------- diff --git a/README.zh-CN.md b/README.zh-CN.md index ad46a6f..af7da6f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,8 +1,8 @@ ## Caesium 命令行工具 -###### caesium-clt - v0.16.0-beta (build 20211023) +###### caesium-clt - v0.17.0-beta (build 20221001) ###### 依赖 -* [libcaesium](https://github.com/Lymphatus/libcaesium) >= 0.6.0 +* [libcaesium](https://github.com/Lymphatus/libcaesium) >= 0.9.2 ###### 已包含的库 * [optparse](https://github.com/skeeto/optparse) @@ -11,8 +11,8 @@ ---------- ###### 已通过测试的平台 -* Mac OS X Big Sur (v10.15) -* Ubuntu 20.04 +* macOS Monterey (v12.6) +* Ubuntu 22.04 * Windows 10 ---------- @@ -80,6 +80,7 @@ $ caesiumclt -q 0 -RS -o ~/output/ ~/Pictures ---------- ###### 变更日志 +* 0.17.0-beta - libcaesium bump * 0.16.0-beta - Using libcaesium Rust library * 0.15.2-beta - Fixed Windows -RS bug * 0.15.1-beta - Fixed rename bug on Windows + "Compressing..." message diff --git a/src/helper.c b/src/helper.c index e855977..24155e2 100644 --- a/src/helper.c +++ b/src/helper.c @@ -65,7 +65,7 @@ cclt_options parse_arguments(char **argv, C_CSParameters *options) { options->optimize = true; } else { options->jpeg_quality = quality; - options->png_level = parse_png_quality(quality); + options->png_quality = quality; options->webp_quality = quality; options->gif_quality = quality; } diff --git a/src/helper.h b/src/helper.h index 0af9b33..63cd15b 100644 --- a/src/helper.h +++ b/src/helper.h @@ -37,11 +37,13 @@ typedef enum overwrite_policy { typedef struct C_CSParameters { bool keep_metadata; unsigned int jpeg_quality; - unsigned int png_level; + unsigned int png_quality; bool png_force_zopfli; unsigned int gif_quality; unsigned int webp_quality; bool optimize; + int width; + int height; } C_CSParameters; extern bool c_compress(const char *i, const char *o, struct C_CSParameters params); diff --git a/src/main.c b/src/main.c index 0ac711f..6db24bb 100755 --- a/src/main.c +++ b/src/main.c @@ -36,11 +36,13 @@ int main(int argc, char *argv[]) C_CSParameters compress_options = { false, 80, - 3, + 80, false, 20, 60, - false + false, + 0, + 0 }; //Set them according to command line parameters options = parse_arguments(argv, &compress_options); diff --git a/src/utils.c b/src/utils.c index 35fd1d5..f2f45dc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -157,7 +157,7 @@ int mkpath(const char *pathname) { parent[sizeof(parent) - 1] = '\0'; for (p = parent + strlen(parent); *p != '/' && p != parent; p--); *p = '\0'; - /* try make parent directory */ + /* try to make parent directory */ if (p != parent && mkpath(parent) != 0) { return -1; } @@ -237,15 +237,6 @@ bool file_exists(const char *file_path) { return (stat(file_path, &buffer) == 0); } -int strndx(const char *string, const char search) { - char *pointer = strchr(string, search); - if (pointer == NULL) { - return -1; - } else { - return (int) (pointer - string); - } -} - overwrite_policy parse_overwrite_policy(const char *overwrite_string) { if (strcmp(overwrite_string, "none") == 0) { return none; @@ -359,20 +350,4 @@ char *strsep(char **stringp, const char *delim) return begin; } -#endif - -int parse_png_quality(int quality) { - if (quality >= 1 && quality <= 39) { - return 1; - } else if (quality >= 40 && quality <= 49) { - return 2; - } else if (quality >= 50 && quality <= 59) { - return 3; - } else if (quality >= 60 && quality <= 69) { - return 4; - } else if (quality >= 70 && quality <= 79) { - return 6; - } else { - return 7; - } -} \ No newline at end of file +#endif \ No newline at end of file diff --git a/src/utils.h b/src/utils.h index cc8c457..2afafe9 100644 --- a/src/utils.h +++ b/src/utils.h @@ -36,14 +36,10 @@ int mkpath(const char *pathname); bool file_exists(const char* file_path); -int strndx(const char* string, char search); - overwrite_policy parse_overwrite_policy(const char* overwrite_string); void print_to_console(FILE* buffer, int verbose, const char* format, ...); -int parse_png_quality(int quality); - #ifdef _WIN32 char *str_replace(char *orig, char *rep, char *with); char *strsep(char **stringp, const char *delim);