• 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 ZipLevel : int32_t {
36     ZIP_LEVEL_DEFAULT = Z_DEFAULT_COMPRESSION,
37     ZIP_LEVEL_0 = Z_NO_COMPRESSION,
38     ZIP_LEVEL_1 = Z_BEST_SPEED,
39     ZIP_LEVEL_2,
40     ZIP_LEVEL_3,
41     ZIP_LEVEL_4,
42     ZIP_LEVEL_5,
43     ZIP_LEVEL_6,
44     ZIP_LEVEL_7,
45     ZIP_LEVEL_8,
46     ZIP_LEVEL_9 = Z_BEST_COMPRESSION
47 };
48 
49 static const ZipLevel ZIP_LEVEL_NO_COMPRESS = ZipLevel::ZIP_LEVEL_0;
50 static const ZipLevel ZIP_LEVEL_BEST_SPEED = ZipLevel::ZIP_LEVEL_1;
51 static const ZipLevel ZIP_LEVEL_BEST_COMPRESS = ZipLevel::ZIP_LEVEL_9;
52 
53 static const int32_t ZIP_FILE_ATTR_DEFAULT = 0;
54 static const int32_t ZIP_FILE_ATTR_DIRECTORY = 16;
55 
56 static const int32_t MAX_ZIP_BUFFER_SIZE = 4096;
57 }  // namespace AppPackingTool
58 }  // namespace OHOS
59 #endif  // DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_ZIP_CONSTANTS_H
60