diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-01-12 00:12:21 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2006-01-12 00:12:21 (GMT) |
commit | 48808133b01b498ae6983a61deb8e66e986c281f (patch) | |
tree | 9168b880be48b8ffcb35861f51486c2e8624c02b | |
parent | 867c3a763e3183ef2c2f32e6c930ea49ae34a5f1 (diff) | |
download | CMake-48808133b01b498ae6983a61deb8e66e986c281f.zip CMake-48808133b01b498ae6983a61deb8e66e986c281f.tar.gz CMake-48808133b01b498ae6983a61deb8e66e986c281f.tar.bz2 |
ENH: Fix compression on Windows
-rw-r--r-- | Source/CPack/cmCPackTGZGenerator.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index efdbdd4..941f47b 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -59,8 +59,7 @@ class cmCPackTGZ_Data { public: cmCPackTGZ_Data(cmCPackTGZGenerator* gen) : - Name(0), OutputStream(0), Generator(gen), m_CompressionLevel(Z_DEFAULT_COMPRESSION) {} - const char *Name; + OutputStream(0), Generator(gen), m_CompressionLevel(Z_DEFAULT_COMPRESSION) {} std::ostream* OutputStream; cmCPackTGZGenerator* Generator; char m_CompressedBuffer[cmCPackTGZ_Data_BlockSize]; @@ -92,15 +91,15 @@ int cmCPackTGZ_Data_Open(void *client_data, const char* pathname, int, mode_t) return -1; } - cmGeneratedFileStream* gf = new cmGeneratedFileStream(pathname); + cmGeneratedFileStream* gf = new cmGeneratedFileStream; + // Open binary + gf->Open(pathname, false, true); mydata->OutputStream = gf; if ( !*mydata->OutputStream ) { return -1; } - - gf->SetCompression(false); - + if ( !cmCPackTGZGeneratorForward::GenerateHeader(mydata->Generator,gf)) { return -1; @@ -116,14 +115,13 @@ ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n) { cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; - mydata->m_ZLibStream.avail_in = n; mydata->m_ZLibStream.next_in = reinterpret_cast<Bytef*>(buff); do { mydata->m_ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize; mydata->m_ZLibStream.next_out = reinterpret_cast<Bytef*>(mydata->m_CompressedBuffer); - int ret = deflate(&mydata->m_ZLibStream, (n?Z_NO_FLUSH:Z_FINISH)); /* no bad return value */ + int ret = deflate(&mydata->m_ZLibStream, (n?Z_NO_FLUSH:Z_FINISH)); // no bad return value if(ret == Z_STREAM_ERROR) { return 0; |