mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 00:54:06 +02:00
BaseTools: Add --version option in Brotli and BrotliCompress
https://bugzilla.tianocore.org/show_bug.cgi?id=464 V2: - Add build version V1: - Add --version option in Brotli and BrotliCompress Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bell Song <binx.song@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
9ee3283bfb
commit
98cb468435
@ -11,32 +11,43 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
LVL="--quality 9"
|
QLT="-q 9"
|
||||||
|
INPUTFLAG=0
|
||||||
|
|
||||||
while [ $# != 0 ];do
|
while [ $# != 0 ];do
|
||||||
case $1 in
|
case $1 in
|
||||||
-d)
|
-d)
|
||||||
ARGS+="--decompress "
|
INPUTFLAG=1
|
||||||
|
ARGS+="$1 "
|
||||||
;;
|
;;
|
||||||
-e)
|
-e)
|
||||||
|
INPUTFLAG=1
|
||||||
;;
|
;;
|
||||||
-g)
|
-g)
|
||||||
ARGS+="--gap $2 "
|
ARGS+="$1 $2 "
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-l)
|
|
||||||
LVL="--quality $2 "
|
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-o)
|
-o)
|
||||||
ARGS+="--output $2 "
|
ARGS+="$1 $2 "
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-q)
|
||||||
|
QLT="$1 $2 "
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ARGS+="--input $1 "
|
if [ $INPUTFLAG -eq 1 ]
|
||||||
|
then
|
||||||
|
if [ -z $2 ]
|
||||||
|
then
|
||||||
|
ARGS+="$QLT -i $1 "
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
ARGS+="$1 "
|
||||||
esac
|
esac
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
exec Brotli $ARGS $LVL
|
exec Brotli $ARGS
|
||||||
|
@ -14,48 +14,54 @@
|
|||||||
@echo off
|
@echo off
|
||||||
@setlocal
|
@setlocal
|
||||||
|
|
||||||
set LVL=--quality 9
|
set QLT=-q 9
|
||||||
|
set INPUTFLAG=0
|
||||||
|
|
||||||
:Begin
|
:Begin
|
||||||
if "%1"=="" goto End
|
if "%1"=="" goto End
|
||||||
|
|
||||||
if "%1"=="-d" (
|
if "%1"=="-d" (
|
||||||
set ARGS=%ARGS% --decompress
|
set INPUTFLAG=1
|
||||||
shift
|
|
||||||
goto Begin
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%1"=="-e" (
|
if "%1"=="-e" (
|
||||||
|
set INPUTFLAG=1
|
||||||
shift
|
shift
|
||||||
goto Begin
|
goto Begin
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%1"=="-g" (
|
if "%1"=="-g" (
|
||||||
set ARGS=%ARGS% --gap %2
|
set ARGS=%ARGS% %1 %2
|
||||||
shift
|
|
||||||
shift
|
|
||||||
goto Begin
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1"=="-l" (
|
|
||||||
set LVL=--quality %2
|
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
goto Begin
|
goto Begin
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%1"=="-o" (
|
if "%1"=="-o" (
|
||||||
set ARGS=%ARGS% --output %2
|
set ARGS=%ARGS% %1 %2
|
||||||
set INTMP=%2
|
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
goto Begin
|
goto Begin
|
||||||
)
|
)
|
||||||
|
|
||||||
set ARGS=%ARGS% --input %1
|
if "%1"=="-q" (
|
||||||
|
set QLT=%1 %2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
goto Begin
|
||||||
|
)
|
||||||
|
|
||||||
|
if %INPUTFLAG%==1 (
|
||||||
|
if "%2"=="" (
|
||||||
|
set ARGS=%ARGS% %QLT% -i %1
|
||||||
|
goto End
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
set ARGS=%ARGS% %1
|
||||||
shift
|
shift
|
||||||
goto Begin
|
goto Begin
|
||||||
|
|
||||||
:End
|
:End
|
||||||
Brotli %ARGS% %LVL%
|
Brotli %ARGS%
|
||||||
@echo on
|
@echo on
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <Common/BuildVersion.h>
|
||||||
|
|
||||||
#include "../dec/decode.h"
|
#include "../dec/decode.h"
|
||||||
#include "../enc/encode.h"
|
#include "../enc/encode.h"
|
||||||
@ -67,6 +68,11 @@ static int ParseQuality(const char* s, int* quality) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define UTILITY_NAME "Brotli"
|
||||||
|
#define UTILITY_MAJOR_VERSION 0
|
||||||
|
#define UTILITY_MINOR_VERSION 5
|
||||||
|
#define UTILITY_REVERSION 2
|
||||||
|
|
||||||
static void ParseArgv(int argc, char **argv,
|
static void ParseArgv(int argc, char **argv,
|
||||||
char **input_path,
|
char **input_path,
|
||||||
char **output_path,
|
char **output_path,
|
||||||
@ -110,6 +116,15 @@ static void ParseArgv(int argc, char **argv,
|
|||||||
}
|
}
|
||||||
*verbose = 1;
|
*verbose = 1;
|
||||||
continue;
|
continue;
|
||||||
|
} else if (!strcmp("--version", argv[k])) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s Version %d.%d.%d %s\n",
|
||||||
|
UTILITY_NAME,
|
||||||
|
UTILITY_MAJOR_VERSION,
|
||||||
|
UTILITY_MINOR_VERSION,
|
||||||
|
UTILITY_REVERSION,
|
||||||
|
__BUILD_VERSION);
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
if (k < argc - 1) {
|
if (k < argc - 1) {
|
||||||
if (!strcmp("--input", argv[k]) ||
|
if (!strcmp("--input", argv[k]) ||
|
||||||
@ -177,7 +192,8 @@ error:
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [--force] [--quality n] [--gap n] [--decompress]"
|
"Usage: %s [--force] [--quality n] [--gap n] [--decompress]"
|
||||||
" [--input filename] [--output filename] [--repeat iters]"
|
" [--input filename] [--output filename] [--repeat iters]"
|
||||||
" [--verbose] [--window n] [--custom-dictionary filename]\n",
|
" [--verbose] [--window n] [--custom-dictionary filename]"
|
||||||
|
" [--version]\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user