diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-10-01 08:05:58 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-10-01 08:05:58 +0000 |
commit | 9c4f626959d24b90f30bf28ff6aead1e604450ba (patch) | |
tree | 086b5065db470cd2226516a10dc8cf8bc2b31019 /rdbmaker | |
parent | a7889e93afcd4dc7343dcfbc2fb9f6a912b3b382 (diff) |
CWS-TOOLING: integrate CWS jsc311
Diffstat (limited to 'rdbmaker')
-rw-r--r-- | rdbmaker/inc/codemaker/global.hxx | 13 | ||||
-rw-r--r-- | rdbmaker/inc/codemaker/options.hxx | 6 | ||||
-rw-r--r-- | rdbmaker/source/codemaker/global.cxx | 183 | ||||
-rw-r--r-- | rdbmaker/source/codemaker/options.cxx | 19 |
4 files changed, 4 insertions, 217 deletions
diff --git a/rdbmaker/inc/codemaker/global.hxx b/rdbmaker/inc/codemaker/global.hxx index d48ede13c..587962667 100644 --- a/rdbmaker/inc/codemaker/global.hxx +++ b/rdbmaker/inc/codemaker/global.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: global.hxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.8.1 $ * * This file is part of OpenOffice.org. * @@ -74,15 +74,6 @@ typedef ::std::set< ::rtl::OString, LessString > StringSet; ::rtl::OString makeTempName(); -::rtl::OString createFileNameFromType(const ::rtl::OString& destination, - const ::rtl::OString type, - const ::rtl::OString postfix, - sal_Bool bLowerCase=sal_False, - const ::rtl::OString prefix=""); - -sal_Bool fileExists(const ::rtl::OString& fileName); -sal_Bool checkFileContent(const ::rtl::OString& targetFileName, const ::rtl::OString& tmpFileName); - const ::rtl::OString inGlobalSet(const ::rtl::OUString & r); inline const ::rtl::OString inGlobalSet(sal_Char* p) { @@ -108,7 +99,6 @@ class FileStream //: public ofstream { public: FileStream(); - FileStream(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE); virtual ~FileStream(); sal_Bool isValid(); @@ -116,7 +106,6 @@ public: void open(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE); void close(); - sal_Int32 getSize(); ::rtl::OString getName() { return m_name; } // friend functions diff --git a/rdbmaker/inc/codemaker/options.hxx b/rdbmaker/inc/codemaker/options.hxx index 871115099..cfd6d43c4 100644 --- a/rdbmaker/inc/codemaker/options.hxx +++ b/rdbmaker/inc/codemaker/options.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: options.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.8.1 $ * * This file is part of OpenOffice.org. * @@ -88,10 +88,6 @@ public: sal_Bool isValid(const ::rtl::OString& option); const ::rtl::OString getOption(const ::rtl::OString& option) throw( IllegalArgument ); - const OptionMap& getOptions(); - - const ::rtl::OString getInputFile(sal_uInt16 index) - throw( IllegalArgument ); const StringVector& getInputFiles(); diff --git a/rdbmaker/source/codemaker/global.cxx b/rdbmaker/source/codemaker/global.cxx index 7a44c1be5..138fb623d 100644 --- a/rdbmaker/source/codemaker/global.cxx +++ b/rdbmaker/source/codemaker/global.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: global.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.8.1 $ * * This file is part of OpenOffice.org. * @@ -59,162 +59,6 @@ using namespace ::rtl; using namespace ::osl; -OString createFileNameFromType( const OString& destination, - const OString typeName, - const OString postfix, - sal_Bool bLowerCase, - const OString prefix ) -{ - OString type(typeName); - - if (bLowerCase) - { - type = typeName.toAsciiLowerCase(); - } - - sal_uInt32 length = destination.getLength(); - - sal_Bool withPoint = sal_False; - if (length == 0) - { - length++; - withPoint = sal_True; - } - - length += prefix.getLength() + type.getLength() + postfix.getLength(); - - sal_Bool withSeperator = sal_False; - if (destination.getStr()[destination.getLength()] != '\\' && - destination.getStr()[destination.getLength()] != '/' && - type.getStr()[0] != '\\' && - type.getStr()[0] != '/') - { - length++; - withSeperator = sal_True; - } - - OStringBuffer nameBuffer(length); - - if (withPoint) - nameBuffer.append('.'); - else - nameBuffer.append(destination.getStr(), destination.getLength()); - - if (withSeperator) - nameBuffer.append("/", 1); - - OString tmpStr(type); - if (prefix.getLength() > 0) - { - tmpStr = type.replaceAt(type.lastIndexOf('/')+1, 0, prefix); - } - - nameBuffer.append(tmpStr.getStr(), tmpStr.getLength()); - nameBuffer.append(postfix.getStr(), postfix.getLength()); - - OString fileName(nameBuffer); - - sal_Char token; -#ifdef SAL_UNX - fileName = fileName.replace('\\', '/'); - token = '/'; -#else - fileName = fileName.replace('/', '\\'); - token = '\\'; -#endif - - nameBuffer = OStringBuffer(length); - - sal_Int32 nIndex = 0; - do - { - nameBuffer.append(fileName.getToken( 0, token, nIndex ).getStr()); - - if (nameBuffer.getLength() == 0 || OString(".") == nameBuffer.getStr()) - { - nameBuffer.append(token); - continue; - } - -#if defined(SAL_UNX) || defined(SAL_OS2) - if (mkdir((char*)nameBuffer.getStr(), 0777) == -1) -#else - if (mkdir((char*)nameBuffer.getStr()) == -1) -#endif - { - if ( errno == ENOENT ) - return OString(); - } - - nameBuffer.append(token); - } - while ( nIndex >= 0 ); - - return fileName; -} - -sal_Bool fileExists(const OString& fileName) -{ - FILE *f= fopen(fileName.getStr(), "r"); - - if (f != NULL) - { - fclose(f); - return sal_True; - } - - return sal_False; -} - -sal_Bool checkFileContent(const OString& targetFileName, const OString& tmpFileName) -{ - FILE *target = fopen(targetFileName.getStr(), "r"); - FILE *tmp = fopen(tmpFileName.getStr(), "r"); - sal_Bool ret = sal_False; - - if (target != NULL && tmp != NULL) - { - sal_Bool bFindChanges = sal_False; - sal_Char buffer1[1024+1]; - sal_Char buffer2[1024+1]; - sal_Int32 n1 = 0; - sal_Int32 n2 = 0; - - while ( !bFindChanges && !feof(target) && !feof(tmp)) - { - n1 = fread(buffer1, sizeof(sal_Char), 1024, target); - n2 = fread(buffer2, sizeof(sal_Char), 1024, tmp); - - if ( n1 != n2 ) - { - bFindChanges = sal_True; - } - else - { - if ( rtl_compareMemory(buffer1, buffer2, n2) != 0 ) - bFindChanges = sal_True; - } - } - - fclose(target); - fclose(tmp); - - if ( bFindChanges ) - { - if ( !unlink(targetFileName.getStr()) ) - if ( !rename(tmpFileName.getStr(), targetFileName.getStr()) ) - ret = sal_True; - } - else - { - if ( !unlink(tmpFileName.getStr()) ) - ret = sal_True; - } - } - - return ret; -} - const OString inGlobalSet(const OUString & rValue) { OString sValue( OUStringToOString(rValue, RTL_TEXTENCODING_UTF8) ); @@ -271,16 +115,6 @@ FileStream::FileStream() { } -FileStream::FileStream(const OString& name, FileAccessMode mode) - : m_pFile(NULL) -{ - if ( name.getLength() > 0 ) - { - m_name = name; - m_pFile = fopen(m_name, checkAccessMode(mode)); - } -} - FileStream::~FileStream() { if ( isValid() ) @@ -318,21 +152,6 @@ void FileStream::close() } } -sal_Int32 FileStream::getSize() -{ - sal_Int32 pos = 0; - sal_Int32 size = 0; - if ( isValid() ) - { - fflush(m_pFile); - pos = ftell(m_pFile); - if (!fseek(m_pFile, 0, SEEK_END)) - size = ftell(m_pFile); - fseek(m_pFile, pos, SEEK_SET); - } - return size; -} - const sal_Char* FileStream::checkAccessMode(FileAccessMode mode) { switch( mode ) diff --git a/rdbmaker/source/codemaker/options.cxx b/rdbmaker/source/codemaker/options.cxx index 6e659e7f1..16b63a921 100644 --- a/rdbmaker/source/codemaker/options.cxx +++ b/rdbmaker/source/codemaker/options.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: options.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.8.1 $ * * This file is part of OpenOffice.org. * @@ -63,23 +63,6 @@ const OString Options::getOption(const OString& option) } } -const OptionMap& Options::getOptions() -{ - return m_options; -} - -const OString Options::getInputFile(sal_uInt16 index) - throw( IllegalArgument ) -{ - if (index < m_inputFiles.size()) - { - return m_inputFiles[index]; - } else - { - throw IllegalArgument("index is out of bound."); - } -} - const StringVector& Options::getInputFiles() { return m_inputFiles; |