summaryrefslogtreecommitdiff
path: root/rdbmaker/source/codemaker/global.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'rdbmaker/source/codemaker/global.cxx')
-rw-r--r--rdbmaker/source/codemaker/global.cxx183
1 files changed, 1 insertions, 182 deletions
diff --git a/rdbmaker/source/codemaker/global.cxx b/rdbmaker/source/codemaker/global.cxx
index 01eeb4c455f2..5d342b25fef7 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 )