diff options
-rw-r--r-- | Source/CPack/cmCPackGenericGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenericGenerator.h | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackTGZGenerator.cxx | 40 | ||||
-rw-r--r-- | Source/CPack/cmCPackTGZGenerator.h | 10 |
4 files changed, 37 insertions, 21 deletions
diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx index 4f3b96c..f79db75 100644 --- a/Source/CPack/cmCPackGenericGenerator.cxx +++ b/Source/CPack/cmCPackGenericGenerator.cxx @@ -272,13 +272,6 @@ const char* cmCPackGenericGenerator::GetOption(const char* op) } //---------------------------------------------------------------------- -int cmCPackGenericGenerator::GenerateHeader(std::ostream* os) -{ - (void)os; - return 1; -} - -//---------------------------------------------------------------------- int cmCPackGenericGenerator::FindRunningCMake(const char* arg0) { int found = 0; diff --git a/Source/CPack/cmCPackGenericGenerator.h b/Source/CPack/cmCPackGenericGenerator.h index f9dddc3..f4725da 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 c337e6f..baa612d 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -32,6 +32,16 @@ #include <errno.h> //---------------------------------------------------------------------- +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 c536a8e..1d2b028 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<std::string>& files); virtual const char* GetOutputExtension() { return "tar.gz"; } |