• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_ZIP_CONSTANTS_H
17 #define DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_ZIP_CONSTANTS_H
18 
19 #include <filesystem>
20 #include <string>
21 #include <map>
22 
23 #include "contrib/minizip/unzip.h"
24 #include "contrib/minizip/zip.h"
25 
26 namespace fs = std::filesystem;
27 
28 namespace OHOS {
29 namespace AppPackingTool {
30 enum ZipErrCode {
31     ZIP_ERR_FAILURE = -1,
32     ZIP_ERR_SUCCESS = 0
33 };
34 
35 enum class ZipMethod : int32_t {
36     ZIP_METHOD_STORED = 0,
37     ZIP_METHOD_DEFLATED = Z_DEFLATED
38 };
39 
40 enum class ZipLevel : int32_t {
41     ZIP_LEVEL_DEFAULT = Z_DEFAULT_COMPRESSION,
42     ZIP_LEVEL_0 = Z_NO_COMPRESSION,
43     ZIP_LEVEL_1 = Z_BEST_SPEED,
44     ZIP_LEVEL_2,
45     ZIP_LEVEL_3,
46     ZIP_LEVEL_4,
47     ZIP_LEVEL_5,
48     ZIP_LEVEL_6,
49     ZIP_LEVEL_7,
50     ZIP_LEVEL_8,
51     ZIP_LEVEL_9 = Z_BEST_COMPRESSION
52 };
53 
54 static const ZipLevel ZIP_LEVEL_NO_COMPRESS = ZipLevel::ZIP_LEVEL_0;
55 static const ZipLevel ZIP_LEVEL_BEST_SPEED = ZipLevel::ZIP_LEVEL_1;
56 static const ZipLevel ZIP_LEVEL_BEST_COMPRESS = ZipLevel::ZIP_LEVEL_9;
57 
58 static const int32_t ZIP_FILE_ATTR_DEFAULT = 0;
59 static const int32_t ZIP_FILE_ATTR_DIRECTORY = 16;
60 
61 static const int32_t MAX_ZIP_BUFFER_SIZE = 4096;
62 }  // namespace AppPackingTool
63 }  // namespace OHOS
64 #endif  // DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_ZIP_CONSTANTS_H
65