diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 (patch) | |
tree | 54fd1b2695a591d2306d41264df67c53077b752c /include/zipfile/zipfile.h | |
download | system_core-4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53.zip system_core-4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53.tar.gz system_core-4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53.tar.bz2 |
Initial Contribution
Diffstat (limited to 'include/zipfile/zipfile.h')
-rw-r--r-- | include/zipfile/zipfile.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/zipfile/zipfile.h b/include/zipfile/zipfile.h new file mode 100644 index 0000000..0ae4ee4 --- /dev/null +++ b/include/zipfile/zipfile.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _ZIPFILE_ZIPFILE_H +#define _ZIPFILE_ZIPFILE_H + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* zipfile_t; +typedef void* zipentry_t; + +// Provide a buffer. Returns NULL on failure. +zipfile_t init_zipfile(const void* data, size_t size); + +// Release the zipfile resources. +void release_zipfile(zipfile_t file); + +// Get a named entry object. Returns NULL if it doesn't exist +// or if we won't be able to decompress it. The zipentry_t is +// freed by release_zipfile() +zipentry_t lookup_zipentry(zipfile_t file, const char* entryName); + +// Return the size of the entry. +size_t get_zipentry_size(zipentry_t entry); + +// return the filename of this entry, you own the memory returned +char* get_zipentry_name(zipentry_t entry); + +// The buffer must be 1.001 times the buffer size returned +// by get_zipentry_size. Returns nonzero on failure. +int decompress_zipentry(zipentry_t entry, void* buf, int bufsize); + +// iterate through the entries in the zip file. pass a pointer to +// a void* initialized to NULL to start. Returns NULL when done +zipentry_t iterate_zipfile(zipfile_t file, void** cookie); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // _ZIPFILE_ZIPFILE_H |