login about faq

I am doing upgrade testing on CkZip, the results are different between 9.4.0 and
Could you please check it for me? I need to zip/unzip byteDate only in memory without zip file output.
I expect copy() provides compressed data, which success in 9.4.0, but failed in 9.5.0.x.
The function implements as following,

bool ZipByte(IN CkByteData& dbRawData, OUT CkByteData& dbCompres) {

  CkZip zip;

  if ( !zip.UnlockComponent(unlockKey) )
         return false;
  if ( !zip.NewZip(unusedFilename) )
         return false;

  CkZipEntry* entry = zip.AppendData(unusedFilename, dbRawData);
  if ( entry == NULL ) {
         return false;

  if ( !entry->Copy(dbCompres) ) /*** failed in new version:9.5.0.x. ***/  
         delete entry; entry = NULL;      
         return false;

  delete entry; entry = NULL;      

  std::cout << dbCompres.getEncoded("hex") << std::endl;
  return true;



DllDate: Oct  1 2014
UnlockPrefix: ----------
Username: xxxxxxxxxx:uuuuuuuu
Architecture: Little Endian; 32-bit
Language: Visual C++ 8.0 (32-bit)
VerboseLogging: 1
Must be an entry within an opened zip archive.



asked Apr 09 '15 at 00:34

Simopro's gravatar image


edited Apr 09 '15 at 00:39

Thanks. The old version would try to compress the data if the entry was not already a "mapped entry". This was very problematic for many reasons, and that functionality was removed for a simpler implementation that is more explicitly driven by the application.

I updated the reference documentation for the ZipEntry object. (See http://www.chilkatsoft.com/refdoc/vcCkZipEntryRef.html ) See the information for the EntryType property, as well as the Copy method.

In summary, an entry can be one of the following types:

  • Mapped Entry: An entry in an existing Zip file.
  • File Entry: A file not yet in memory, but referenced. These entries are added by calling AppendFiles, AppendFilesEx, AppendOneFileOrDir, etc.
  • Data Entry: An entry containing uncompressed data from memory. These entries are added by calling AppendData, AppendString, etc.
  • Null Entry: An entry that no longer exists in the .zip.
  • New Directory Entry: A directory entry added by calling AppendNewDir.

When the zip is written by calling WriteZip or WriteToMemory, all of the zip entries are transformed into mapped entries. They become entries that contain the compressed data within the .zip that was just created. (The WriteZip method call effectively writes the zip and then opens it, replacing all of the existing entries with mapped entries.)

A better solution is to use CkCompression instead of CkZip if you only want to compress data. You would use the "deflate" compression algorithm. The CkCompression object has been part of the "Zip license" for a long time now, so you may use your Zip unlock code with CkCompression in the newer version.

I'll post a CkCompression example shortly that can be used to replace your code above..


answered Apr 09 '15 at 10:17

chilkat's gravatar image

chilkat ♦♦

Here is the example using CkCompression:

    CkCompression compress;

CkByteData dbIn;
bool success = dbIn.loadFile("qa_data/hamlet.xml");
if (!success) return false;


std::cout &lt;&lt; compress.compressBytesENC(dbIn) &lt;&lt; std::endl;

answered Apr 09 '15 at 10:53

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Apr 09 '15 at 00:34

Seen: 1,352 times

Last updated: Apr 09 '15 at 10:53

powered by OSQA