libcaesium bump to 0.9.2

This commit is contained in:
Matteo Paonessa 2022-10-02 11:51:50 +02:00
parent 546f8cfb09
commit 9bc590b907
7 changed files with 19 additions and 43 deletions

View File

@ -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
----------

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
}
#endif

View File

@ -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);