This topic describes only module-specific error codes. For details about universal error codes, see Universal Error Codes.
Error Message
The input source file is invalid.
Description
This error code is reported when the source file passed in the compressFile() or decompressFile() API is invalid.
Possible Causes
Solution
Check the source file path.
Ensure that the path is not empty, does not contain relative paths such as "../", and is located in the correct application sandbox path.
Check whether the source file exists and whether the application has the read permission on the source file.
When calling the decompressFile API, check whether the source file can be opened normally and ensure that the file extension is .zip.
Error Message
The input destination file is invalid.
Description
This error code is reported when the destination file passed in the compressFile() or decompressFile() API is invalid.
Possible Causes
Solution
Check the target path.
Ensure that the path is not empty, does not contain relative paths such as "../", and is located in the correct application sandbox path.
Before calling the decompressFile API, check whether the target path is an existing directory. If the directory does not exist, create it first.
Check whether the application has the write permission on the target directory.
Check whether there are abnormal entries in the target directory that prevent the creation of a directory or file with the same name, and ensure that the target directory has sufficient available storage space.
Error Message
The input source file is not in ZIP format or is damaged.
Description
This error code is reported when the format of the source file is incorrect or the source file is damaged when the decompressFile API is called.
Possible Causes
Solution
Check whether the source file is a valid and complete ZIP file.
If the source file is downloaded over the network, ensure that the file download is complete before calling the decompressFile API. If the file is corrupted, regenerate or obtain the ZIP file.
Check the entry paths in the ZIP file to ensure that the paths do not contain relative paths such as "../". If such entries exist, remove the related entries and regenerate the ZIP file.
Check whether each entry in the ZIP file can be read and decompressed normally. If an entry is corrupted, regenerate or obtain the ZIP file.
Error Message
No such file or access mode error.
Description
This error code is reported when the input file path, file descriptor, or file access mode is incorrect when the gzopen or gzdopen API is called.
Possible Causes
Solution
Error Message
Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure.
Description
This error code is reported when an error occurs in compression or decompression stream when the deflate or inflate API is called.
Possible Causes
Solution
Error Message
The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed.
Description
This error code is reported when the input data is incorrect when the uncompress or uncompress2 API is called.
Possible Causes
When the uncompress or uncompress2 API is called, the compress API is not used for compression.
Solution
Use the compress API to compress the file before using the uncompress2 or uncompress API to decompress the file.
Error Message
Memory allocation failed.
Description
This error code is reported when the memory allocation fails when the gzclose or gzclosew API is called.
Possible Causes
The gzsetparams API is called before calling the gzclose or gzclosew API. As a result, an incorrect compression level or compression strategy is passed in.
Solution
Check whether the gzsetparams API is called and pass in the correct compression level and compression strategy.
Error Message
The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data.
Description
This error code is reported when the input buffer is incorrect when the compress, compress2, uncompress, or uncompress2 API is called.
Possible Causes
Solution
Increase the size of the corresponding buffer.
Error Message
Internal structure error.
Description
This error code is reported when the input parameter is incorrect when the gzputc, gzwrite, or gzread API is called, or when the input file access mode is incorrect when the API for opening the .gz file is called.
Possible Causes
Solution