diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index 4f3b96c039..f79db75680 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -271,13 +271,6 @@ const char* cmCPackGenericGenerator::GetOption(const char* op) return m_MakefileMap->GetDefinition(op); } -//---------------------------------------------------------------------- -int cmCPackGenericGenerator::GenerateHeader(std::ostream* os) -{ - (void)os; - return 1; -} - //---------------------------------------------------------------------- int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) { diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h index f9dddc3ba3..f4725da5d9 100644 --- a/Source/CPack/cmCPackGenericGenerator.h +++ b/Source/CPack/cmCPackGenericGenerator.h @@ -70,7 +70,6 @@ public: protected: int PrepareNames(); int InstallProject(); - virtual int GenerateHeader(std::ostream* os); virtual const char* GetOutputExtension() { return "cpack"; } virtual const char* GetOutputPostfix() { return 0; } diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index c337e6fc7a..baa612d355 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -31,6 +31,16 @@ #include #include +//---------------------------------------------------------------------- +class cmCPackTGZGeneratorForward +{ + public: + static int GenerateHeader(cmCPackTGZGenerator* gg, std::ostream* os) + { + return gg->GenerateHeader(os); + } +}; + //---------------------------------------------------------------------- cmCPackTGZGenerator::cmCPackTGZGenerator() { @@ -64,8 +74,15 @@ public: cmCPackTGZGenerator* Generator; }; +extern "C" { + int cmCPackTGZ_Data_Open(void *client_data, const char* name, int oflags, mode_t mode); + ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n); + int cmCPackTGZ_Data_Close(void *client_data); +} + + //---------------------------------------------------------------------- -int cmCPackTGZGenerator::TGZ_Open(void *client_data, const char* pathname, int, mode_t) +int cmCPackTGZ_Data_Open(void *client_data, const char* pathname, int, mode_t) { cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; @@ -79,7 +96,7 @@ int cmCPackTGZGenerator::TGZ_Open(void *client_data, const char* pathname, int, gf->SetCompression(true); gf->SetCompressionExtraExtension(false); - if ( !mydata->Generator->GenerateHeader(mydata->OutputStream)) + if ( !cmCPackTGZGeneratorForward::GenerateHeader(mydata->Generator,mydata->OutputStream)) { return -1; } @@ -87,7 +104,7 @@ int cmCPackTGZGenerator::TGZ_Open(void *client_data, const char* pathname, int, } //---------------------------------------------------------------------- -ssize_t cmCPackTGZGenerator::TGZ_Write(void *client_data, void *buff, size_t n) +ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n) { cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; @@ -100,7 +117,7 @@ ssize_t cmCPackTGZGenerator::TGZ_Write(void *client_data, void *buff, size_t n) } //---------------------------------------------------------------------- -int cmCPackTGZGenerator::TGZ_Close(void *client_data) +int cmCPackTGZ_Data_Close(void *client_data) { cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; @@ -120,10 +137,10 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, const char* topl char pathname[TAR_MAXPATHLEN]; tartype_t gztype = { - (openfunc_t)cmCPackTGZGenerator::TGZ_Open, - (closefunc_t)cmCPackTGZGenerator::TGZ_Close, + (openfunc_t)cmCPackTGZ_Data_Open, + (closefunc_t)cmCPackTGZ_Data_Close, (readfunc_t)0, - (writefunc_t)cmCPackTGZGenerator::TGZ_Write, + (writefunc_t)cmCPackTGZ_Data_Write, &mydata }; @@ -173,3 +190,12 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, const char* topl } return 1; } + +//---------------------------------------------------------------------- +int cmCPackTGZGenerator::GenerateHeader(std::ostream* os) +{ + (void)os; + return 1; +} + + diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index c536a8e239..1d2b0280c4 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -18,9 +18,9 @@ #ifndef cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h - #include "cmCPackGenericGenerator.h" -#include "CPack/cmCPackConfigure.h" // for ssize_t + +class cmCPackTGZGeneratorForward; /** \class cmCPackTGZGenerator * \brief A generator for TGZ files @@ -30,6 +30,7 @@ class cmCPackTGZGenerator : public cmCPackGenericGenerator { public: + friend class cmCPackTGZGeneratorForward; cmCPackTypeMacro(cmCPackTGZGenerator, cmCPackGenericGenerator); /** @@ -50,10 +51,7 @@ public: virtual ~cmCPackTGZGenerator(); protected: - static int TGZ_Open(void *client_data, const char* name, int oflags, mode_t mode); - static ssize_t TGZ_Write(void *client_data, void *buff, size_t n); - static int TGZ_Close(void *client_data); - + virtual int GenerateHeader(std::ostream* os); int CompressFiles(const char* outFileName, const char* toplevel, const std::vector& files); virtual const char* GetOutputExtension() { return "tar.gz"; }