| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2008 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 |  | 
| Mathias Agopian | f446ba9 | 2009-06-04 13:53:57 -0700 | [diff] [blame] | 17 | #include <utils/ZipFileCRO.h> | 
|  | 18 | #include <utils/ZipFileRO.h> | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 |  | 
|  | 20 | using namespace android; | 
|  | 21 |  | 
|  | 22 | ZipFileCRO ZipFileXRO_open(const char* path) { | 
|  | 23 | ZipFileRO* zip = new ZipFileRO(); | 
|  | 24 | if (zip->open(path) == NO_ERROR) { | 
|  | 25 | return (ZipFileCRO)zip; | 
|  | 26 | } | 
|  | 27 | return NULL; | 
|  | 28 | } | 
|  | 29 |  | 
|  | 30 | void ZipFileCRO_destroy(ZipFileCRO zipToken) { | 
|  | 31 | ZipFileRO* zip = (ZipFileRO*)zipToken; | 
|  | 32 | delete zip; | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zipToken, | 
|  | 36 | const char* fileName) { | 
|  | 37 | ZipFileRO* zip = (ZipFileRO*)zipToken; | 
|  | 38 | return (ZipEntryCRO)zip->findEntryByName(fileName); | 
|  | 39 | } | 
|  | 40 |  | 
|  | 41 | bool ZipFileCRO_getEntryInfo(ZipFileCRO zipToken, ZipEntryRO entryToken, | 
| Kenny Root | d4066a4 | 2010-04-22 18:28:29 -0700 | [diff] [blame] | 42 | int* pMethod, size_t* pUncompLen, | 
|  | 43 | size_t* pCompLen, off_t* pOffset, long* pModWhen, long* pCrc32) { | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 44 | ZipFileRO* zip = (ZipFileRO*)zipToken; | 
|  | 45 | ZipEntryRO entry = (ZipEntryRO)entryToken; | 
|  | 46 | return zip->getEntryInfo(entry, pMethod, pUncompLen, pCompLen, pOffset, | 
|  | 47 | pModWhen, pCrc32); | 
|  | 48 | } | 
|  | 49 |  | 
|  | 50 | bool ZipFileCRO_uncompressEntry(ZipFileCRO zipToken, ZipEntryRO entryToken, int fd) { | 
|  | 51 | ZipFileRO* zip = (ZipFileRO*)zipToken; | 
|  | 52 | ZipEntryRO entry = (ZipEntryRO)entryToken; | 
|  | 53 | return zip->uncompressEntry(entry, fd); | 
|  | 54 | } |