[Libreoffice-commits] core.git: connectivity/source
Julien Nabet
serval2412 at yahoo.fr
Tue Jun 13 21:53:33 UTC 2017
connectivity/source/drivers/dbase/DTable.cxx | 98 +++++++++++++--------------
connectivity/source/inc/dbase/DTable.hxx | 28 +++----
2 files changed, 63 insertions(+), 63 deletions(-)
New commits:
commit e599716735a8d992ae614462412d4b82c119d40a
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Tue Jun 13 23:51:44 2017 +0200
dBASE: remove wrong m_ prefix introduced in a recent commit
Change-Id: I9f05facd98d60604256b15c4b35871f7d0a825f9
Reviewed-on: https://gerrit.libreoffice.org/38755
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index e84c75de0fe2..14c75d283b34 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -204,58 +204,58 @@ void ODbaseTable::readHeader()
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadBytes(m_aHeader.m_dateElems, 3);
+ m_pFileStream->ReadBytes(m_aHeader.dateElems, 3);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUInt32( m_aHeader.m_nbRecords);
+ m_pFileStream->ReadUInt32( m_aHeader.nbRecords);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUInt16( m_aHeader.m_headerLength);
+ m_pFileStream->ReadUInt16( m_aHeader.headerLength);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUInt16( m_aHeader.m_recordLength);
+ m_pFileStream->ReadUInt16( m_aHeader.recordLength);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- if (m_aHeader.m_recordLength == 0)
+ if (m_aHeader.recordLength == 0)
throwInvalidDbaseFormat();
- m_pFileStream->ReadBytes(m_aHeader.m_reserved1, 2);
+ m_pFileStream->ReadBytes(m_aHeader.reserved1, 2);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUChar(m_aHeader.m_incompTransact);
+ m_pFileStream->ReadUChar(m_aHeader.incompTransact);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUChar(m_aHeader.m_encryptionFlag);
+ m_pFileStream->ReadUChar(m_aHeader.encryptionFlag);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadBytes(m_aHeader.m_freeRecordThread, 4);
+ m_pFileStream->ReadBytes(m_aHeader.freeRecordThread, 4);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadBytes(m_aHeader.m_multiUserdBASE, 8);
+ m_pFileStream->ReadBytes(m_aHeader.multiUserdBASE, 8);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUChar(m_aHeader.m_MDXFlag);
+ m_pFileStream->ReadUChar(m_aHeader.MDXFlag);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadUChar(m_aHeader.m_languageDriver);
+ m_pFileStream->ReadUChar(m_aHeader.languageDriver);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- m_pFileStream->ReadBytes(m_aHeader.m_reserved2, 2);
+ m_pFileStream->ReadBytes(m_aHeader.reserved2, 2);
if(ERRCODE_NONE != m_pFileStream->GetErrorCode())
throwInvalidDbaseFormat();
- if ( ( ( m_aHeader.m_headerLength - 1 ) / 32 - 1 ) <= 0 ) // number of fields
+ if ( ( ( m_aHeader.headerLength - 1 ) / 32 - 1 ) <= 0 ) // number of fields
{
// no dBASE file
throwInvalidDbaseFormat();
@@ -263,8 +263,8 @@ void ODbaseTable::readHeader()
else
{
// Consistency check of the header:
- m_aHeader.m_type = (DBFType)nType;
- switch (m_aHeader.m_type)
+ m_aHeader.type = (DBFType)nType;
+ switch (m_aHeader.type)
{
case dBaseIII:
case dBaseIV:
@@ -277,9 +277,9 @@ void ODbaseTable::readHeader()
case dBaseIIIMemo:
case FoxProMemo:
m_pFileStream->SetEndian(SvStreamEndian::LITTLE);
- if ( m_aHeader.m_languageDriver != 0x00 && getConnection()->isTextEncodingDefaulted() )
+ if ( m_aHeader.languageDriver != 0x00 && getConnection()->isTextEncodingDefaulted() )
{
- switch(m_aHeader.m_languageDriver)
+ switch(m_aHeader.languageDriver)
{
case 0x01: m_eEncoding = RTL_TEXTENCODING_IBM_437; break; // DOS USA code page 437
case 0x02: m_eEncoding = RTL_TEXTENCODING_IBM_850; break; // DOS Multilingual code page 850
@@ -347,7 +347,7 @@ void ODbaseTable::fillColumns()
m_aScales.clear();
// Number of fields:
- const sal_Int32 nFieldCount = (m_aHeader.m_headerLength - 1) / 32 - 1;
+ const sal_Int32 nFieldCount = (m_aHeader.headerLength - 1) / 32 - 1;
OSL_ENSURE(nFieldCount,"No columns in table!");
m_aColumns->get().reserve(nFieldCount);
@@ -357,7 +357,7 @@ void ODbaseTable::fillColumns()
OUString aTypeName;
const bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers();
- const bool bFoxPro = m_aHeader.m_type == VisualFoxPro || m_aHeader.m_type == VisualFoxProAuto || m_aHeader.m_type == FoxProMemo;
+ const bool bFoxPro = m_aHeader.type == VisualFoxPro || m_aHeader.type == VisualFoxProAuto || m_aHeader.type == FoxProMemo;
sal_Int32 i = 0;
for (; i < nFieldCount; i++)
@@ -456,7 +456,7 @@ void ODbaseTable::fillColumns()
break;
case '0':
case 'B':
- if ( m_aHeader.m_type == VisualFoxPro || m_aHeader.m_type == VisualFoxProAuto )
+ if ( m_aHeader.type == VisualFoxPro || m_aHeader.type == VisualFoxProAuto )
{
aTypeName = "DOUBLE";
eType = DataType::DOUBLE;
@@ -500,7 +500,7 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConne
{
// initialize the header
memset(&m_aHeader, 0, sizeof(m_aHeader));
- m_aHeader.m_type = dBaseIII;
+ m_aHeader.type = dBaseIII;
m_eEncoding = getConnection()->getTextEncoding();
}
@@ -525,10 +525,10 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConne
void ODbaseTable::construct()
{
// initialize the header
- m_aHeader.m_type = dBaseIII;
- m_aHeader.m_nbRecords = 0;
- m_aHeader.m_headerLength = 0;
- m_aHeader.m_recordLength = 0;
+ m_aHeader.type = dBaseIII;
+ m_aHeader.nbRecords = 0;
+ m_aHeader.headerLength = 0;
+ m_aHeader.recordLength = 0;
m_aMemoHeader.db_size = 0;
OUString sFileName(getEntry(m_pConnection, m_Name));
@@ -557,7 +557,7 @@ void ODbaseTable::construct()
// Create Memo-Filename (.DBT):
// nyi: Ugly for Unix and Mac!
- if ( m_aHeader.m_type == FoxProMemo || m_aHeader.m_type == VisualFoxPro || m_aHeader.m_type == VisualFoxProAuto) // foxpro uses another extension
+ if ( m_aHeader.type == FoxProMemo || m_aHeader.type == VisualFoxPro || m_aHeader.type == VisualFoxProAuto) // foxpro uses another extension
aURL.SetExtension("fpt");
else
aURL.SetExtension("dbt");
@@ -579,11 +579,11 @@ void ODbaseTable::construct()
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
// seems to be empty or someone wrote bullshit into the dbase file
// try and recover if m_aHeader.db_slng is sane
- if (m_aHeader.m_nbRecords == 0 && m_aHeader.m_recordLength)
+ if (m_aHeader.nbRecords == 0 && m_aHeader.recordLength)
{
- std::size_t nRecords = (nFileSize-m_aHeader.m_headerLength)/m_aHeader.m_recordLength;
+ std::size_t nRecords = (nFileSize-m_aHeader.headerLength)/m_aHeader.recordLength;
if (nRecords > 0)
- m_aHeader.m_nbRecords = nRecords;
+ m_aHeader.nbRecords = nRecords;
}
// Buffersize dependent on the file size
@@ -616,7 +616,7 @@ bool ODbaseTable::ReadMemoHeader()
m_pMemoStream->Seek(0L);
(*m_pMemoStream).ReadUInt32( m_aMemoHeader.db_next );
- switch (m_aHeader.m_type)
+ switch (m_aHeader.type)
{
case dBaseIIIMemo: // dBase III: fixed block size
case dBaseIVMemo:
@@ -1166,10 +1166,10 @@ bool ODbaseTable::CreateImpl()
}
return false;
}
- m_aHeader.m_type = dBaseIIIMemo;
+ m_aHeader.type = dBaseIIIMemo;
}
else
- m_aHeader.m_type = dBaseIII;
+ m_aHeader.type = dBaseIII;
return true;
}
@@ -1532,14 +1532,14 @@ bool ODbaseTable::InsertRow(OValueRefVector& rRow, const Reference<XIndexAccess>
if (!AllocBuffer())
return false;
- memset(m_pBuffer, 0, m_aHeader.m_recordLength);
+ memset(m_pBuffer, 0, m_aHeader.recordLength);
m_pBuffer[0] = ' ';
// Copy new row completely:
// ... and add at the end as new Record:
std::size_t nTempPos = m_nFilePos;
- m_nFilePos = (std::size_t)m_aHeader.m_nbRecords + 1;
+ m_nFilePos = (std::size_t)m_aHeader.nbRecords + 1;
bool bInsertRow = UpdateBuffer( rRow, nullptr, _xCols, true );
if ( bInsertRow )
{
@@ -1566,12 +1566,12 @@ bool ODbaseTable::InsertRow(OValueRefVector& rRow, const Reference<XIndexAccess>
(*m_pFileStream).WriteChar( (char)DBF_EOL ); // write EOL
// raise number of datasets in the header:
m_pFileStream->Seek( 4L );
- (*m_pFileStream).WriteUInt32( m_aHeader.m_nbRecords + 1 );
+ (*m_pFileStream).WriteUInt32( m_aHeader.nbRecords + 1 );
m_pFileStream->Flush();
// raise number if successfully
- m_aHeader.m_nbRecords++;
+ m_aHeader.nbRecords++;
*rRow.get()[0] = m_nFilePos; // set bookmark
m_nFilePos = nTempPos;
}
@@ -1590,9 +1590,9 @@ bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow, const
return false;
// position on desired record:
- std::size_t nPos = m_aHeader.m_headerLength + (long)(m_nFilePos-1) * m_aHeader.m_recordLength;
+ std::size_t nPos = m_aHeader.headerLength + (long)(m_nFilePos-1) * m_aHeader.recordLength;
m_pFileStream->Seek(nPos);
- m_pFileStream->ReadBytes(m_pBuffer, m_aHeader.m_recordLength);
+ m_pFileStream->ReadBytes(m_pBuffer, m_aHeader.recordLength);
std::size_t nMemoFileSize( 0 );
if (HasMemoFields() && m_pMemoStream)
@@ -1617,7 +1617,7 @@ bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols)
{
// Set the Delete-Flag (be it set or not):
// Position on desired record:
- std::size_t nFilePos = m_aHeader.m_headerLength + (long)(m_nFilePos-1) * m_aHeader.m_recordLength;
+ std::size_t nFilePos = m_aHeader.headerLength + (long)(m_nFilePos-1) * m_aHeader.recordLength;
m_pFileStream->Seek(nFilePos);
OValueRefRow aRow = new OValueRefVector(_rCols.get().size());
@@ -2561,7 +2561,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos)
sal_Int32 nCurPos;
OValueRefVector::Vector::const_iterator aIter;
- for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.m_nbRecords;++nRowPos)
+ for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.nbRecords;++nRowPos)
{
bool bOk = seekRow( IResultSetHelper::BOOKMARK, nRowPos+1, nCurPos );
if ( bOk )
@@ -2612,7 +2612,7 @@ void ODbaseTable::throwInvalidDbaseFormat()
void ODbaseTable::refreshHeader()
{
- if ( m_aHeader.m_nbRecords == 0 )
+ if ( m_aHeader.nbRecords == 0 )
readHeader();
}
@@ -2621,7 +2621,7 @@ bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32
// prepare positioning:
OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!");
- sal_uInt32 nNumberOfRecords = m_aHeader.m_nbRecords;
+ sal_uInt32 nNumberOfRecords = m_aHeader.nbRecords;
sal_uInt32 nTempPos = m_nFilePos;
m_nFilePos = nCurPos;
@@ -2657,10 +2657,10 @@ bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32
goto Error;
else
{
- std::size_t nEntryLen = m_aHeader.m_recordLength;
+ std::size_t nEntryLen = m_aHeader.recordLength;
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
- std::size_t nPos = m_aHeader.m_headerLength + (std::size_t)(m_nFilePos-1) * nEntryLen;
+ std::size_t nPos = m_aHeader.headerLength + (std::size_t)(m_nFilePos-1) * nEntryLen;
m_pFileStream->Seek(nPos);
if (m_pFileStream->GetError() != ERRCODE_NONE)
@@ -2780,7 +2780,7 @@ bool ODbaseTable::ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable)
bool ODbaseTable::AllocBuffer()
{
- sal_uInt16 nSize = m_aHeader.m_recordLength;
+ sal_uInt16 nSize = m_aHeader.recordLength;
SAL_WARN_IF(nSize == 0, "connectivity.drivers", "Size too small");
if (m_nBufferSize != nSize)
@@ -2804,14 +2804,14 @@ bool ODbaseTable::WriteBuffer()
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
// position on desired record:
- std::size_t nPos = m_aHeader.m_headerLength + (long)(m_nFilePos-1) * m_aHeader.m_recordLength;
+ std::size_t nPos = m_aHeader.headerLength + (long)(m_nFilePos-1) * m_aHeader.recordLength;
m_pFileStream->Seek(nPos);
- return m_pFileStream->WriteBytes(m_pBuffer, m_aHeader.m_recordLength) > 0;
+ return m_pFileStream->WriteBytes(m_pBuffer, m_aHeader.recordLength) > 0;
}
sal_Int32 ODbaseTable::getCurrentLastPos() const
{
- return m_aHeader.m_nbRecords;
+ return m_aHeader.nbRecords;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index ead441308dfa..867cde2e8e00 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -58,22 +58,22 @@ namespace connectivity
// sources: https://www.clicketyclick.dk/databases/xbase/format/dbf.html (dBASE III and 5)
// http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm (dBASE 7) which is similar at least for this part
struct DBFHeader {
- DBFType m_type; // dBASE/xBASE type, see DBFType
- sal_uInt8 m_dateElems[3]; // Date of last change (YYMMDD)
- sal_uInt32 m_nbRecords; // Number of records
- sal_uInt16 m_headerLength;
- sal_uInt16 m_recordLength; // length of 1 record
- sal_uInt8 m_reserved1[2]; // should be filled with 0
- sal_uInt8 m_incompTransact; // Incomplete transaction (dBASE IV):
+ DBFType type; // dBASE/xBASE type, see DBFType
+ sal_uInt8 dateElems[3]; // Date of last change (YYMMDD)
+ sal_uInt32 nbRecords; // Number of records
+ sal_uInt16 headerLength;
+ sal_uInt16 recordLength; // length of 1 record
+ sal_uInt8 reserved1[2]; // should be filled with 0
+ sal_uInt8 incompTransact; // Incomplete transaction (dBASE IV):
// 00h Transaction ended (or rolled back)
// 01h Transaction started
- sal_uInt8 m_encryptionFlag; // dBASE IV: 00h not encrypted, 01h data encrypted
- sal_uInt8 m_freeRecordThread[4]; // reserved for LAN only
- sal_uInt8 m_multiUserdBASE[8]; // reserved for multi-user dBASE (dBASE III+)
- sal_uInt8 m_MDXFlag; // dBASE IV 0x01 if a production .MDX file exists for this table
+ sal_uInt8 encryptionFlag; // dBASE IV: 00h not encrypted, 01h data encrypted
+ sal_uInt8 freeRecordThread[4]; // reserved for LAN only
+ sal_uInt8 multiUserdBASE[8]; // reserved for multi-user dBASE (dBASE III+)
+ sal_uInt8 MDXFlag; // dBASE IV 0x01 if a production .MDX file exists for this table
// 0x00 if no .MDX file exists
- sal_uInt8 m_languageDriver; // codepage (from Foxpro)
- sal_uInt8 m_reserved2[2]; // should be filled with 0
+ sal_uInt8 languageDriver; // codepage (from Foxpro)
+ sal_uInt8 reserved2[2]; // should be filled with 0
};
struct DBFColumn { /* Column descriptors */
sal_uInt8 db_fnm[11]; /* Field name */
@@ -114,7 +114,7 @@ namespace connectivity
void copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos);
bool CreateFile(const INetURLObject& aFile, bool& bCreateMemo);
bool CreateMemoFile(const INetURLObject& aFile);
- bool HasMemoFields() const { return m_aHeader.m_type > dBaseIV;}
+ bool HasMemoFields() const { return m_aHeader.type > dBaseIV;}
bool ReadMemoHeader();
bool ReadMemo(std::size_t nBlockNo, ORowSetValue& aVariable);
More information about the Libreoffice-commits
mailing list