Removed reliance on the tools/debug stuff
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: Deflater.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mtg $ $Date: 2000-11-16 22:50:51 $
|
||||
* last change: $Author: mtg $ $Date: 2000-11-21 12:07:21 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -158,10 +158,10 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int
|
||||
return nNewLength - pStream->avail_out;
|
||||
case Z_BUF_ERROR:
|
||||
bSetParams = sal_False;
|
||||
DBG_ERROR( pStream->msg );
|
||||
VOS_DEBUG_ONLY( pStream->msg );
|
||||
return 0;
|
||||
default:
|
||||
DBG_ERROR( pStream->msg );
|
||||
VOS_DEBUG_ONLY( pStream->msg );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -183,10 +183,10 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int
|
||||
return nNewLength - pStream->avail_out;
|
||||
case Z_BUF_ERROR:
|
||||
bSetParams = sal_False;
|
||||
DBG_ERROR( pStream->msg );
|
||||
VOS_DEBUG_ONLY( pStream->msg );
|
||||
return 0;
|
||||
default:
|
||||
DBG_ERROR( pStream->msg );
|
||||
VOS_DEBUG_ONLY( pStream->msg );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void SAL_CALL Deflater::setInputSegment( const uno::Sequence< sal_Int8 >& rBuffe
|
||||
throw(uno::RuntimeException)
|
||||
{
|
||||
if (nNewOffset < 0 || nNewLength < 0 || nNewOffset + nNewLength > rBuffer.getLength())
|
||||
DBG_ERROR("Invalid parameters to Deflater::setInputSegment!");
|
||||
VOS_DEBUG_ONLY("Invalid parameters to Deflater::setInputSegment!");
|
||||
|
||||
sInBuffer = rBuffer;
|
||||
nOffset = nNewOffset;
|
||||
@@ -215,7 +215,7 @@ void SAL_CALL Deflater::setDictionarySegment( const uno::Sequence< sal_Int8 >& r
|
||||
if (pStream == NULL)
|
||||
{
|
||||
// do error handling
|
||||
DBG_ERROR("No stream!");
|
||||
VOS_DEBUG_ONLY("No stream!");
|
||||
}
|
||||
if (nNewOffset < 0 || nNewLength < 0 || nNewOffset + nNewLength > rBuffer.getLength())
|
||||
{
|
||||
@@ -229,7 +229,7 @@ void SAL_CALL Deflater::setDictionary( const uno::Sequence< sal_Int8 >& rBuffer
|
||||
if (pStream == NULL)
|
||||
{
|
||||
// do error handling
|
||||
DBG_ERROR("No stream!");
|
||||
VOS_DEBUG_ONLY("No stream!");
|
||||
|
||||
}
|
||||
sal_Int32 nResult = z_deflateSetDictionary(pStream, (const unsigned char*)rBuffer.getConstArray(), rBuffer.getLength());
|
||||
@@ -281,7 +281,7 @@ sal_Int32 SAL_CALL Deflater::doDeflateSegment( uno::Sequence< sal_Int8 >& rBuffe
|
||||
throw(uno::RuntimeException)
|
||||
{
|
||||
if (nNewOffset < 0 || nNewLength < 0 || nNewOffset + nNewLength > rBuffer.getLength())
|
||||
DBG_ERROR("Invalid Offset or Length passed to doDeflateSegment");
|
||||
VOS_DEBUG_ONLY("Invalid Offset or Length passed to doDeflateSegment");
|
||||
return doDeflateBytes(rBuffer, nNewOffset, nNewLength);
|
||||
}
|
||||
sal_Int32 SAL_CALL Deflater::doDeflate( uno::Sequence< sal_Int8 >& rBuffer )
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: Inflater.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mtg $ $Date: 2000-11-16 22:50:51 $
|
||||
* last change: $Author: mtg $ $Date: 2000-11-21 12:07:21 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -78,15 +78,15 @@ void Inflater::init (sal_Bool bNowrap)
|
||||
case Z_OK:
|
||||
break;
|
||||
case Z_MEM_ERROR:
|
||||
DBG_ERROR ( pStream->msg);
|
||||
VOS_DEBUG_ONLY ( pStream->msg);
|
||||
delete pStream;
|
||||
break;
|
||||
case Z_STREAM_ERROR:
|
||||
DBG_ERROR ( pStream->msg);
|
||||
VOS_DEBUG_ONLY ( pStream->msg);
|
||||
delete pStream;
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR ( pStream->msg);
|
||||
VOS_DEBUG_ONLY ( pStream->msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ sal_Int32 Inflater::doInflateBytes (com::sun::star::uno::Sequence < sal_Int8 >
|
||||
case Z_BUF_ERROR:
|
||||
return 0;
|
||||
case Z_DATA_ERROR:
|
||||
DBG_ERROR(pStream->msg);
|
||||
VOS_DEBUG_ONLY(pStream->msg);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: ZipFile.cxx,v $
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* last change: $Author: mtg $ $Date: 2000-11-16 11:55:52 $
|
||||
* last change: $Author: mtg $ $Date: 2000-11-21 12:07:21 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -225,7 +225,7 @@ sal_Bool ZipFile::readLOC(const package::ZipEntry &rEntry)
|
||||
|
||||
if (nTestSig != LOCSIG)
|
||||
{
|
||||
DBG_ERROR ("Invalid LOC header (bad signature)");
|
||||
VOS_DEBUG_ONLY ("Invalid LOC header (bad signature)");
|
||||
return sal_False;
|
||||
}
|
||||
aGrabber >> nVersion;
|
||||
@@ -346,12 +346,12 @@ sal_Int32 ZipFile::readCEN()
|
||||
|
||||
if (nTotal<0 || nTotal * CENHDR > nCenLen)
|
||||
{
|
||||
DBG_ERROR("invalid END header (bad entry count)");
|
||||
VOS_DEBUG_ONLY("invalid END header (bad entry count)");
|
||||
return -1;
|
||||
}
|
||||
if (nTotal > ZIP_MAXENTRIES)
|
||||
{
|
||||
DBG_ERROR("too many entries in ZIP File");
|
||||
VOS_DEBUG_ONLY("too many entries in ZIP File");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -360,14 +360,14 @@ sal_Int32 ZipFile::readCEN()
|
||||
|
||||
if (nCenLen < 0 || nCenLen > nEndPos)
|
||||
{
|
||||
DBG_ERROR ("invalid END header (bad central directory size)");
|
||||
VOS_DEBUG_ONLY ("invalid END header (bad central directory size)");
|
||||
return -1;
|
||||
}
|
||||
nCenPos = nEndPos - nCenLen;
|
||||
|
||||
if (nCenOff < 0 || nCenOff > nCenPos)
|
||||
{
|
||||
DBG_ERROR("invalid END header (bad central directory size)");
|
||||
VOS_DEBUG_ONLY("invalid END header (bad central directory size)");
|
||||
return -1;
|
||||
}
|
||||
nLocPos = nCenPos - nCenOff;
|
||||
@@ -387,27 +387,27 @@ sal_Int32 ZipFile::readCEN()
|
||||
sal_Int16 nDisk, nIntAttr;
|
||||
if (aGrabber.getPosition() - nCenPos + CENHDR > nCenLen)
|
||||
{
|
||||
DBG_ERROR("invalid CEN header (bad header size check 1");
|
||||
VOS_DEBUG_ONLY("invalid CEN header (bad header size check 1");
|
||||
break;
|
||||
}
|
||||
aGrabber >> nTestSig;
|
||||
if (nTestSig != CENSIG)
|
||||
{
|
||||
DBG_ERROR ("invalid CEN header (bad signature)");
|
||||
VOS_DEBUG_ONLY ("invalid CEN header (bad signature)");
|
||||
break;
|
||||
}
|
||||
aGrabber >> nVerMade;
|
||||
aGrabber >> nVersion;
|
||||
if ((nVersion & 1) == 1)
|
||||
{
|
||||
DBG_ERROR ( "invalid CEN header (encrypted entry)");
|
||||
VOS_DEBUG_ONLY ( "invalid CEN header (encrypted entry)");
|
||||
break;
|
||||
}
|
||||
aGrabber >> nFlag;
|
||||
aGrabber >> nHow;
|
||||
if (nHow != STORED && nHow != DEFLATED)
|
||||
{
|
||||
DBG_ERROR ( "invalid CEN header (bad compression method)");
|
||||
VOS_DEBUG_ONLY ( "invalid CEN header (bad compression method)");
|
||||
break;
|
||||
}
|
||||
aGrabber >> nTime;
|
||||
@@ -424,17 +424,17 @@ sal_Int32 ZipFile::readCEN()
|
||||
|
||||
if (aGrabber.getPosition() - nCenPos + nNameLen + nExtraLen + nCommentLen > nCenLen)
|
||||
{
|
||||
DBG_ERROR ( "invalid CEN header (bad header size check 2)");
|
||||
VOS_DEBUG_ONLY ( "invalid CEN header (bad header size check 2)");
|
||||
break;
|
||||
}
|
||||
if (nNameLen > ZIP_MAXNAMELEN)
|
||||
{
|
||||
DBG_ERROR ( "name length exceeds 512 bytes");
|
||||
VOS_DEBUG_ONLY ( "name length exceeds 512 bytes");
|
||||
break;
|
||||
}
|
||||
if (nExtraLen > ZIP_MAXEXTRA)
|
||||
{
|
||||
DBG_ERROR ( "extra header info exceeds 256 bytes");
|
||||
VOS_DEBUG_ONLY ( "extra header info exceeds 256 bytes");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ sal_Int32 ZipFile::readCEN()
|
||||
|
||||
if (nCount != nTotal)
|
||||
{
|
||||
DBG_ERROR("Count != total!");
|
||||
VOS_DEBUG_ONLY("Count != total!");
|
||||
return -1;
|
||||
}
|
||||
return nCenPos;
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: ZipOutputStream.cxx,v $
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: mtg $ $Date: 2000-11-16 22:50:51 $
|
||||
* last change: $Author: mtg $ $Date: 2000-11-21 12:07:21 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -106,9 +106,8 @@ void SAL_CALL ZipOutputStream::putNextEntry( const package::ZipEntry& rEntry )
|
||||
closeEntry();
|
||||
if (pNonConstEntry->nTime == -1)
|
||||
{
|
||||
Time aTime;
|
||||
aTime = Time();
|
||||
pNonConstEntry->nTime = aTime.GetTime();
|
||||
time_t nTime =0;
|
||||
pNonConstEntry->nTime = tmDateToDosDate(*localtime(&nTime));
|
||||
}
|
||||
if (pNonConstEntry->nMethod == -1)
|
||||
{
|
||||
@@ -161,18 +160,18 @@ void SAL_CALL ZipOutputStream::closeEntry( )
|
||||
{
|
||||
if (pEntry->nSize != aDeflater.getTotalIn())
|
||||
{
|
||||
DBG_ERROR("Invalid entry size");
|
||||
VOS_DEBUG_ONLY("Invalid entry size");
|
||||
}
|
||||
if (pEntry->nCompressedSize != aDeflater.getTotalOut())
|
||||
{
|
||||
//DBG_ERROR("Invalid entry compressed size");
|
||||
//VOS_DEBUG_ONLY("Invalid entry compressed size");
|
||||
// Different compression strategies make the merit of this
|
||||
// test somewhat dubious
|
||||
pEntry->nCompressedSize = aDeflater.getTotalOut();
|
||||
}
|
||||
if (pEntry->nCrc != aCRC.getValue())
|
||||
{
|
||||
DBG_ERROR("Invalid entry CRC-32");
|
||||
VOS_DEBUG_ONLY("Invalid entry CRC-32");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -188,12 +187,12 @@ void SAL_CALL ZipOutputStream::closeEntry( )
|
||||
if (static_cast < sal_uInt32 > (pEntry->nCrc) != static_cast <sal_uInt32> (aCRC.getValue()))
|
||||
{
|
||||
// boom
|
||||
DBG_ERROR("Invalid entry crc32");
|
||||
VOS_DEBUG_ONLY("Invalid entry crc32");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// boom;
|
||||
DBG_ERROR("Invalid compression method");
|
||||
VOS_DEBUG_ONLY("Invalid compression method");
|
||||
break;
|
||||
}
|
||||
aCRC.reset();
|
||||
@@ -230,7 +229,7 @@ void SAL_CALL ZipOutputStream::finish( )
|
||||
if (aZipList.size() < 1)
|
||||
{
|
||||
// boom
|
||||
DBG_ERROR("Zip file must have at least one entry!\n");
|
||||
VOS_DEBUG_ONLY("Zip file must have at least one entry!\n");
|
||||
}
|
||||
sal_Int32 nOffset= aChucker.getPosition();
|
||||
for (int i =0, nEnd = aZipList.size(); i < nEnd; i++)
|
||||
@@ -253,7 +252,7 @@ void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
|
||||
uno::Sequence < sal_Int8 > aSequence (nCommentLength);
|
||||
for ( ; i < nCommentLength; i++)
|
||||
{
|
||||
DBG_ASSERT (pChar[i] <127, "Non US ASCII character in zipfile comment!");
|
||||
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipfile comment!");
|
||||
aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
|
||||
}
|
||||
aChucker << ENDSIG;
|
||||
@@ -294,7 +293,7 @@ void ZipOutputStream::writeCEN( const package::ZipEntry &rEntry )
|
||||
uno::Sequence < sal_Int8 > aSequence (nNameLength);
|
||||
for ( ; i < nNameLength; i++)
|
||||
{
|
||||
DBG_ASSERT (pChar[i] <127, "Non US ASCII character in zipentry name!");
|
||||
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipentry name!");
|
||||
aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
|
||||
}
|
||||
|
||||
@@ -306,7 +305,7 @@ void ZipOutputStream::writeCEN( const package::ZipEntry &rEntry )
|
||||
aSequence.realloc (nCommentLength);
|
||||
for (i=0, pChar = rEntry.sName.getStr(); i < nCommentLength; i++)
|
||||
{
|
||||
DBG_ASSERT (pChar[i] <127, "Non US ASCII character in zipentry comment!");
|
||||
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipentry comment!");
|
||||
aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
|
||||
}
|
||||
aChucker.writeBytes( aSequence );
|
||||
@@ -347,10 +346,37 @@ void ZipOutputStream::writeLOC( const package::ZipEntry &rEntry )
|
||||
uno::Sequence < sal_Int8 > aSequence (nNameLength);
|
||||
for ( ; i < nNameLength; i++)
|
||||
{
|
||||
DBG_ASSERT (pChar[i] <127, "Non US ASCII character in zipentry name!");
|
||||
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipentry name!");
|
||||
aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
|
||||
}
|
||||
aChucker.writeBytes( aSequence );
|
||||
if (rEntry.extra.getLength() != 0)
|
||||
aChucker.writeBytes( rEntry.extra );
|
||||
}
|
||||
sal_uInt32 ZipOutputStream::tmDateToDosDate ( tm &rTime)
|
||||
{
|
||||
sal_uInt32 nYear = static_cast <sal_uInt32> (rTime.tm_year);
|
||||
|
||||
if (nYear>1980)
|
||||
nYear-=1980;
|
||||
else if (nYear>80)
|
||||
nYear-=80;
|
||||
return static_cast < sal_uInt32>( ( ( ( rTime.tm_mday) +
|
||||
( 32 * (rTime.tm_mon+1)) +
|
||||
( 512 * nYear ) ) << 16) |
|
||||
( ( rTime.tm_sec/2) +
|
||||
( 32 * rTime.tm_min) +
|
||||
( 2048 * static_cast <sal_uInt32 > (rTime.tm_hour) ) ) );
|
||||
}
|
||||
void ZipOutputStream::dosDateToTMDate ( tm &rTime, sal_uInt32 nDosDate)
|
||||
{
|
||||
sal_uInt32 nDate = static_cast < sal_uInt32 > (nDosDate >> 16);
|
||||
rTime.tm_mday = static_cast < sal_uInt32 > ( nDate & 0x1F);
|
||||
rTime.tm_mon = static_cast < sal_uInt32 > ( ( ( (nDate) & 0x1E0)/0x20)-1);
|
||||
rTime.tm_year = static_cast < sal_uInt32 > ( ( (nDate & 0x0FE00)/0x0200)+1980);
|
||||
|
||||
rTime.tm_hour = static_cast < sal_uInt32 > ( (nDosDate & 0xF800)/0x800);
|
||||
rTime.tm_min = static_cast < sal_uInt32 > ( (nDosDate & 0x7E0)/0x20);
|
||||
rTime.tm_sec = static_cast < sal_uInt32 > ( 2 * (nDosDate & 0x1F) );
|
||||
}
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#
|
||||
# $RCSfile: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.1 $
|
||||
# $Revision: 1.2 $
|
||||
#
|
||||
# last change: $Author: mtg $ $Date: 2000-11-13 13:38:01 $
|
||||
# last change: $Author: mtg $ $Date: 2000-11-21 12:07:21 $
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# either of the following licenses
|
||||
@@ -85,7 +85,7 @@ SLOFILES= \
|
||||
$(SLO)$/ZipEnumeration.obj \
|
||||
$(SLO)$/ZipFile.obj \
|
||||
$(SLO)$/ZipOutputStream.obj \
|
||||
$(SLO)$/EntryInputStream.obj \
|
||||
$(SLO)$/EntryInputStream.obj
|
||||
|
||||
# --- UNO stuff ---------------------------------------------------
|
||||
|
||||
@@ -108,7 +108,7 @@ UNOTYPES=\
|
||||
com.sun.star.container.XNamed \
|
||||
com.sun.star.container.XNameContainer \
|
||||
com.sun.star.container.XEnumerationAccess \
|
||||
com.sun.star.io.XActiveDataSink \
|
||||
com.sun.star.io.XActiveDataSink
|
||||
|
||||
# --- Targets ------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user