1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ZIPALIGN_H
18 #define ZIPALIGN_H
19 
20 namespace android {
21 
22 /*
23  * Generate a new, aligned, zip "output" from an "input" zip.
24  * - alignTo: Alignment (in bytes) for uncompressed entries.
25  * - force  : Overwrite output if it exists, fail otherwise.
26  * - zopfli : Recompress compressed entries with more efficient algorithm.
27  *            Copy compressed entries as-is, and unaligned, otherwise.
28  * - pageAlignSharedLibs: Align .so files to 4096 and other files to
29  *   alignTo, or all files to alignTo if false..
30  *
31  * Returns 0 on success.
32  */
33 int process(const char* input, const char* output, int alignTo, bool force,
34     bool zopfli, bool pageAlignSharedLibs);
35 
36 /*
37  * Verify the alignment of a zip archive.
38  * - alignTo: Alignment (in bytes) for uncompressed entries.
39  * - pageAlignSharedLibs: Align .so files to 4096 and other files to
40  *   alignTo, or all files to alignTo if false..
41  *
42  * Returns 0 on success.
43  */
44 int verify(const char* fileName, int alignTo, bool verbose,
45     bool pageAlignSharedLibs);
46 
47 } // namespace android
48 
49 #endif // ZIPALIGN_H
50