mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
httpd: makefsdata: fix passing deflate level via commandline
See bug #57187 Reported-by: Anton Chasnyk <anton.chasnyk@gmail.com> Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
parent
bef201e162
commit
fe25ca66af
@ -52,9 +52,8 @@ static uint8 s_checkbuf[OUT_BUF_SIZE];
|
|||||||
/* tdefl_compressor contains all the state needed by the low-level compressor so it's a pretty big struct (~300k).
|
/* tdefl_compressor contains all the state needed by the low-level compressor so it's a pretty big struct (~300k).
|
||||||
This example makes it a global vs. putting it on the stack, of course in real-world usage you'll probably malloc() or new it. */
|
This example makes it a global vs. putting it on the stack, of course in real-world usage you'll probably malloc() or new it. */
|
||||||
tdefl_compressor g_deflator;
|
tdefl_compressor g_deflator;
|
||||||
tinfl_decompressor g_inflator;
|
|
||||||
|
|
||||||
int deflate_level = 10; /* default compression level, can be changed via command line */
|
static int deflate_level; /* default compression level, can be changed via command line */
|
||||||
#define USAGE_ARG_DEFLATE " [-defl<:compr_level>]"
|
#define USAGE_ARG_DEFLATE " [-defl<:compr_level>]"
|
||||||
#else /* MAKEFS_SUPPORT_DEFLATE */
|
#else /* MAKEFS_SUPPORT_DEFLATE */
|
||||||
#define USAGE_ARG_DEFLATE ""
|
#define USAGE_ARG_DEFLATE ""
|
||||||
@ -235,19 +234,20 @@ int main(int argc, char *argv[])
|
|||||||
printf("Writing to file \"%s\"\n", targetfile);
|
printf("Writing to file \"%s\"\n", targetfile);
|
||||||
} else if (!strcmp(argv[i], "-m")) {
|
} else if (!strcmp(argv[i], "-m")) {
|
||||||
includeLastModified = 1;
|
includeLastModified = 1;
|
||||||
} else if (!strcmp(argv[i], "-defl")) {
|
} else if (strstr(argv[i], "-defl") == argv[i]) {
|
||||||
#if MAKEFS_SUPPORT_DEFLATE
|
#if MAKEFS_SUPPORT_DEFLATE
|
||||||
char *colon = strstr(argv[i], ":");
|
const char *colon = &argv[i][5];
|
||||||
if (colon) {
|
if (*colon == ':') {
|
||||||
if (colon[1] != 0) {
|
int defl_level = atoi(&colon[1]);
|
||||||
int defl_level = atoi(&colon[1]);
|
if ((colon[1] != 0) && (defl_level >= 0) && (defl_level <= 10)) {
|
||||||
if ((defl_level >= 0) && (defl_level <= 10)) {
|
deflate_level = defl_level;
|
||||||
deflate_level = defl_level;
|
} else {
|
||||||
} else {
|
printf("ERROR: deflate level must be [0..10]" NEWLINE);
|
||||||
printf("ERROR: deflate level must be [0..10]" NEWLINE);
|
exit(0);
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* default to highest compression */
|
||||||
|
deflate_level = 10;
|
||||||
}
|
}
|
||||||
deflateNonSsiFiles = 1;
|
deflateNonSsiFiles = 1;
|
||||||
printf("Deflating all non-SSI files with level %d (but only if size is reduced)" NEWLINE, deflate_level);
|
printf("Deflating all non-SSI files with level %d (but only if size is reduced)" NEWLINE, deflate_level);
|
||||||
|
Loading…
Reference in New Issue
Block a user