@ -120,7 +120,7 @@ status_t ZipFile::open(const char* zipFileName, int flags)
* have a need for empty zip files . )
*/
mNeedCDRewrite = true ;
result = NO_ERROR ;
result = OK ;
}
if ( flags & kOpenReadOnly )
@ -205,7 +205,7 @@ void ZipFile::discardEntries(void)
*/
status_t ZipFile : : readCentralDir ( void )
{
status_t result = NO_ERROR ;
status_t result = OK ;
uint8_t * buf = NULL ;
off_t fileLength , seekStart ;
long readAmount ;
@ -267,7 +267,7 @@ status_t ZipFile::readCentralDir(void)
/* extract eocd values */
result = mEOCD . readBuf ( buf + i , readAmount - i ) ;
if ( result ! = NO_ERROR ) {
if ( result ! = OK ) {
ALOGD ( " Failure reading %ld bytes of EOCD values " , readAmount - i ) ;
goto bail ;
}
@ -311,7 +311,7 @@ status_t ZipFile::readCentralDir(void)
ZipEntry * pEntry = new ZipEntry ;
result = pEntry - > initFromCDE ( mZipFp ) ;
if ( result ! = NO_ERROR ) {
if ( result ! = OK ) {
ALOGD ( " initFromCDE failed \n " ) ;
delete pEntry ;
goto bail ;
@ -361,7 +361,7 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size,
const char * storageName , int compressionMethod , ZipEntry * * ppEntry )
{
ZipEntry * pEntry = NULL ;
status_t result = NO_ERROR ;
status_t result = OK ;
long lfhPosn , startPosn , endPosn , uncompressedLen ;
FILE * inputFp = NULL ;
uint32_t crc ;
@ -415,7 +415,7 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size,
if ( compressionMethod = = ZipEntry : : kCompressDeflated ) {
bool failed = false ;
result = compressFpToFp ( mZipFp , inputFp , data , size , & crc ) ;
if ( result ! = NO_ERROR ) {
if ( result ! = OK ) {
ALOGD ( " compression failed, storing \n " ) ;
failed = true ;
} else {
@ -447,7 +447,7 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size,
} else {
result = copyDataToFp ( mZipFp , data , size , & crc ) ;
}
if ( result ! = NO_ERROR ) {
if ( result ! = OK ) {
// don't need to truncate; happens in CDE rewrite
ALOGD ( " failed copying data in \n " ) ;
goto bail ;
@ -535,11 +535,11 @@ status_t ZipFile::add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
}
result = pEntry - > initFromExternal ( pSourceEntry ) ;
if ( result ! = NO_ERROR )
if ( result ! = OK )
goto bail ;
if ( padding ! = 0 ) {
result = pEntry - > addPadding ( padding ) ;
if ( result ! = NO_ERROR )
if ( result ! = OK )
goto bail ;
}
@ -574,7 +574,7 @@ status_t ZipFile::add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
copyLen + = ZipEntry : : kDataDescriptorLen ;
if ( copyPartialFpToFp ( mZipFp , pSourceZip - > mZipFp , copyLen , NULL )
! = NO_ERROR )
! = OK )
{
ALOGW ( " copy of '%s' failed \n " , pEntry - > mCDE . mFileName ) ;
result = UNKNOWN_ERROR ;
@ -603,7 +603,7 @@ status_t ZipFile::add(const ZipFile* pSourceZip, const ZipEntry* pSourceEntry,
* ppEntry = pEntry ;
pEntry = NULL ;
result = NO_ERROR ;
result = OK ;
bail :
delete pEntry ;
@ -642,7 +642,7 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
}
result = pEntry - > initFromExternal ( pSourceEntry ) ;
if ( result ! = NO_ERROR )
if ( result ! = OK )
goto bail ;
/*
@ -682,7 +682,7 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
}
long startPosn = ftell ( mZipFp ) ;
uint32_t crc ;
if ( compressFpToFp ( mZipFp , NULL , buf , uncompressedLen , & crc ) ! = NO_ERROR ) {
if ( compressFpToFp ( mZipFp , NULL , buf , uncompressedLen , & crc ) ! = OK ) {
ALOGW ( " recompress of '%s' failed \n " , pEntry - > mCDE . mFileName ) ;
result = UNKNOWN_ERROR ;
free ( buf ) ;
@ -699,7 +699,7 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
copyLen + = ZipEntry : : kDataDescriptorLen ;
if ( copyPartialFpToFp ( mZipFp , pSourceZip - > mZipFp , copyLen , NULL )
! = NO_ERROR )
! = OK )
{
ALOGW ( " copy of '%s' failed \n " , pEntry - > mCDE . mFileName ) ;
result = UNKNOWN_ERROR ;
@ -738,7 +738,7 @@ status_t ZipFile::addRecompress(const ZipFile* pSourceZip, const ZipEntry* pSour
* ppEntry = pEntry ;
pEntry = NULL ;
result = NO_ERROR ;
result = OK ;
bail :
delete pEntry ;
@ -773,7 +773,7 @@ status_t ZipFile::copyFpToFp(FILE* dstFp, FILE* srcFp, uint32_t* pCRC32)
}
}
return NO_ERROR ;
return OK ;
}
/*
@ -793,7 +793,7 @@ status_t ZipFile::copyDataToFp(FILE* dstFp,
}
}
return NO_ERROR ;
return OK ;
}
/*
@ -837,7 +837,7 @@ status_t ZipFile::copyPartialFpToFp(FILE* dstFp, FILE* srcFp, size_t length,
length - = readSize ;
}
return NO_ERROR ;
return OK ;
}
/*
@ -849,7 +849,7 @@ status_t ZipFile::copyPartialFpToFp(FILE* dstFp, FILE* srcFp, size_t length,
status_t ZipFile : : compressFpToFp ( FILE * dstFp , FILE * srcFp ,
const void * data , size_t size , uint32_t * pCRC32 )
{
status_t result = NO_ERROR ;
status_t result = OK ;
const size_t kBufSize = 1024 * 1024 ;
uint8_t * inBuf = NULL ;
uint8_t * outBuf = NULL ;
@ -933,7 +933,7 @@ status_t ZipFile::remove(ZipEntry* pEntry)
/* mark entry as deleted, and mark archive as dirty */
pEntry - > setDeleted ( ) ;
mNeedCDRewrite = true ;
return NO_ERROR ;
return OK ;
}
/*
@ -944,19 +944,19 @@ status_t ZipFile::remove(ZipEntry* pEntry)
*/
status_t ZipFile : : flush ( void )
{
status_t result = NO_ERROR ;
status_t result = OK ;
long eocdPosn ;
int i , count ;
if ( mReadOnly )
return INVALID_OPERATION ;
if ( ! mNeedCDRewrite )
return NO_ERROR ;
return OK ;
assert ( mZipFp ! = NULL ) ;
result = crunchArchive ( ) ;
if ( result ! = NO_ERROR )
if ( result ! = OK )
return result ;
if ( fseek ( mZipFp , mEOCD . mCentralDirOffset , SEEK_SET ) ! = 0 )
@ -986,7 +986,7 @@ status_t ZipFile::flush(void)
/* should we clear the "newly added" flag in all entries now? */
mNeedCDRewrite = false ;
return NO_ERROR ;
return OK ;
}
/*
@ -997,7 +997,7 @@ status_t ZipFile::flush(void)
*/
status_t ZipFile : : crunchArchive ( void )
{
status_t result = NO_ERROR ;
status_t result = OK ;
int i , count ;
long delCount , adjust ;
@ -1065,7 +1065,7 @@ status_t ZipFile::crunchArchive(void)
// pEntry->getFileName(), adjust);
result = filemove ( mZipFp , pEntry - > getLFHOffset ( ) - adjust ,
pEntry - > getLFHOffset ( ) , span ) ;
if ( result ! = NO_ERROR ) {
if ( result ! = OK ) {
/* this is why you use a temp file */
ALOGE ( " error during crunch - archive is toast \n " ) ;
return result ;
@ -1097,7 +1097,7 @@ status_t ZipFile::crunchArchive(void)
status_t ZipFile : : filemove ( FILE * fp , off_t dst , off_t src , size_t n )
{
if ( dst = = src | | n < = 0 )
return NO_ERROR ;
return OK ;
uint8_t readBuf [ 32768 ] ;
@ -1140,7 +1140,7 @@ status_t ZipFile::filemove(FILE* fp, off_t dst, off_t src, size_t n)
return UNKNOWN_ERROR ;
}
return NO_ERROR ;
return OK ;
}
@ -1355,7 +1355,7 @@ status_t ZipFile::EndOfCentralDir::readBuf(const uint8_t* buf, int len)
memcpy ( mComment , buf + kEOCDLen , mCommentLen ) ;
}
return NO_ERROR ;
return OK ;
}
/*
@ -1382,7 +1382,7 @@ status_t ZipFile::EndOfCentralDir::write(FILE* fp)
return UNKNOWN_ERROR ;
}
return NO_ERROR ;
return OK ;
}
/*