connectivity: harmonize types relatated to Tell()/Seek()
Change-Id: I032f6d32b151203e62b23bffaf25dbc4aeb5ae8a Reviewed-on: https://gerrit.libreoffice.org/8217 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
This commit is contained in:
@@ -78,9 +78,9 @@ using namespace ::com::sun::star::i18n;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
sal_Int32 lcl_getFileSize(SvStream& _rStream)
|
sal_Size lcl_getFileSize(SvStream& _rStream)
|
||||||
{
|
{
|
||||||
sal_Int32 nFileSize = 0;
|
sal_Size nFileSize = 0;
|
||||||
_rStream.Seek(STREAM_SEEK_TO_END);
|
_rStream.Seek(STREAM_SEEK_TO_END);
|
||||||
_rStream.SeekRel(-1);
|
_rStream.SeekRel(-1);
|
||||||
char cEOL;
|
char cEOL;
|
||||||
@@ -526,7 +526,7 @@ void ODbaseTable::construct()
|
|||||||
}
|
}
|
||||||
fillColumns();
|
fillColumns();
|
||||||
|
|
||||||
sal_uInt32 nFileSize = lcl_getFileSize(*m_pFileStream);
|
sal_Size nFileSize = lcl_getFileSize(*m_pFileStream);
|
||||||
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
|
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
|
||||||
if ( m_aHeader.db_anz == 0 && ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng) > 0) // seems to be empty or someone wrote bullshit into the dbase file
|
if ( m_aHeader.db_anz == 0 && ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng) > 0) // seems to be empty or someone wrote bullshit into the dbase file
|
||||||
m_aHeader.db_anz = ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng);
|
m_aHeader.db_anz = ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng);
|
||||||
@@ -1498,13 +1498,13 @@ sal_Bool ODbaseTable::InsertRow(OValueRefVector& rRow, sal_Bool bFlush,const Ref
|
|||||||
|
|
||||||
// Copy new row completely:
|
// Copy new row completely:
|
||||||
// ... and add at the end as new Record:
|
// ... and add at the end as new Record:
|
||||||
sal_uInt32 nTempPos = m_nFilePos;
|
sal_Size nTempPos = m_nFilePos;
|
||||||
|
|
||||||
m_nFilePos = (sal_uIntPtr)m_aHeader.db_anz + 1;
|
m_nFilePos = (sal_Size)m_aHeader.db_anz + 1;
|
||||||
sal_Bool bInsertRow = UpdateBuffer( rRow, NULL, _xCols, true );
|
sal_Bool bInsertRow = UpdateBuffer( rRow, NULL, _xCols, true );
|
||||||
if ( bInsertRow )
|
if ( bInsertRow )
|
||||||
{
|
{
|
||||||
sal_uInt32 nFileSize = 0, nMemoFileSize = 0;
|
sal_Size nFileSize = 0, nMemoFileSize = 0;
|
||||||
|
|
||||||
nFileSize = lcl_getFileSize(*m_pFileStream);
|
nFileSize = lcl_getFileSize(*m_pFileStream);
|
||||||
|
|
||||||
@@ -1553,11 +1553,11 @@ sal_Bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,con
|
|||||||
AllocBuffer();
|
AllocBuffer();
|
||||||
|
|
||||||
// position on desired record:
|
// position on desired record:
|
||||||
long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
|
sal_Size nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
|
||||||
m_pFileStream->Seek(nPos);
|
m_pFileStream->Seek(nPos);
|
||||||
m_pFileStream->Read((char*)m_pBuffer, m_aHeader.db_slng);
|
m_pFileStream->Read((char*)m_pBuffer, m_aHeader.db_slng);
|
||||||
|
|
||||||
sal_uInt32 nMemoFileSize( 0 );
|
sal_Size nMemoFileSize( 0 );
|
||||||
if (HasMemoFields() && m_pMemoStream)
|
if (HasMemoFields() && m_pMemoStream)
|
||||||
{
|
{
|
||||||
m_pMemoStream->Seek(STREAM_SEEK_TO_END);
|
m_pMemoStream->Seek(STREAM_SEEK_TO_END);
|
||||||
@@ -1581,7 +1581,7 @@ sal_Bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols)
|
|||||||
SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::DeleteRow" );
|
SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::DeleteRow" );
|
||||||
// Set the Delete-Flag (be it set or not):
|
// Set the Delete-Flag (be it set or not):
|
||||||
// Position on desired record:
|
// Position on desired record:
|
||||||
long nFilePos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
|
sal_Size nFilePos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
|
||||||
m_pFileStream->Seek(nFilePos);
|
m_pFileStream->Seek(nFilePos);
|
||||||
|
|
||||||
OValueRefRow aRow = new OValueRefVector(_rCols.get().size());
|
OValueRefRow aRow = new OValueRefVector(_rCols.get().size());
|
||||||
@@ -1944,7 +1944,7 @@ sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,
|
|||||||
char cNext = pData[nLen]; // Mark's scratch and replaced by 0
|
char cNext = pData[nLen]; // Mark's scratch and replaced by 0
|
||||||
pData[nLen] = '\0'; // This is because the buffer is always a sign of greater ...
|
pData[nLen] = '\0'; // This is because the buffer is always a sign of greater ...
|
||||||
|
|
||||||
sal_uIntPtr nBlockNo = strtol((const char *)pData,NULL,10); // Block number read
|
sal_Size nBlockNo = strtol((const char *)pData,NULL,10); // Block number read
|
||||||
|
|
||||||
// Next initial character restore again:
|
// Next initial character restore again:
|
||||||
pData[nLen] = cNext;
|
pData[nLen] = cNext;
|
||||||
@@ -2001,11 +2001,11 @@ sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlockNr)
|
sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_Size& rBlockNr)
|
||||||
{
|
{
|
||||||
SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::WriteMemo" );
|
SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::WriteMemo" );
|
||||||
// if the BlockNo 0 is given, the block will be appended at the end
|
// if the BlockNo 0 is given, the block will be appended at the end
|
||||||
sal_uIntPtr nSize = 0;
|
sal_Size nSize = 0;
|
||||||
OString aStr;
|
OString aStr;
|
||||||
::com::sun::star::uno::Sequence<sal_Int8> aValue;
|
::com::sun::star::uno::Sequence<sal_Int8> aValue;
|
||||||
sal_uInt8 nHeader[4];
|
sal_uInt8 nHeader[4];
|
||||||
@@ -2038,7 +2038,7 @@ sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlo
|
|||||||
m_pMemoStream->SeekRel(4L);
|
m_pMemoStream->SeekRel(4L);
|
||||||
m_pMemoStream->Read(sHeader,4);
|
m_pMemoStream->Read(sHeader,4);
|
||||||
|
|
||||||
sal_uIntPtr nOldSize;
|
sal_Size nOldSize;
|
||||||
if (m_aMemoHeader.db_typ == MemoFoxPro)
|
if (m_aMemoHeader.db_typ == MemoFoxPro)
|
||||||
nOldSize = ((((unsigned char)sHeader[0]) * 256 +
|
nOldSize = ((((unsigned char)sHeader[0]) * 256 +
|
||||||
(unsigned char)sHeader[1]) * 256 +
|
(unsigned char)sHeader[1]) * 256 +
|
||||||
@@ -2051,7 +2051,7 @@ sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlo
|
|||||||
(unsigned char)sHeader[0] - 8;
|
(unsigned char)sHeader[0] - 8;
|
||||||
|
|
||||||
// fits the new length in the used blocks
|
// fits the new length in the used blocks
|
||||||
sal_uIntPtr nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0),
|
sal_Size nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0),
|
||||||
nOldUsedBlocks = ((nOldSize + 8) / m_aMemoHeader.db_size) + (((nOldSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0);
|
nOldUsedBlocks = ((nOldSize + 8) / m_aMemoHeader.db_size) + (((nOldSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0);
|
||||||
bAppend = nUsedBlocks > nOldUsedBlocks;
|
bAppend = nUsedBlocks > nOldUsedBlocks;
|
||||||
}
|
}
|
||||||
@@ -2060,7 +2060,7 @@ sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlo
|
|||||||
|
|
||||||
if (bAppend)
|
if (bAppend)
|
||||||
{
|
{
|
||||||
sal_uIntPtr nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
|
sal_Size nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
|
||||||
// fill last block
|
// fill last block
|
||||||
rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
|
rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
|
||||||
|
|
||||||
@@ -2124,7 +2124,7 @@ sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlo
|
|||||||
// Write the new block number
|
// Write the new block number
|
||||||
if (bAppend)
|
if (bAppend)
|
||||||
{
|
{
|
||||||
sal_uIntPtr nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
|
sal_Size nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END);
|
||||||
m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
|
m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0);
|
||||||
|
|
||||||
// Write the new block number
|
// Write the new block number
|
||||||
@@ -2627,7 +2627,7 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In
|
|||||||
sal_uInt16 nEntryLen = m_aHeader.db_slng;
|
sal_uInt16 nEntryLen = m_aHeader.db_slng;
|
||||||
|
|
||||||
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
|
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
|
||||||
sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen;
|
sal_Size nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen;
|
||||||
|
|
||||||
m_pFileStream->Seek(nPos);
|
m_pFileStream->Seek(nPos);
|
||||||
if (m_pFileStream->GetError() != ERRCODE_NONE)
|
if (m_pFileStream->GetError() != ERRCODE_NONE)
|
||||||
@@ -2665,7 +2665,7 @@ End:
|
|||||||
return sal_True;
|
return sal_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool ODbaseTable::ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable)
|
sal_Bool ODbaseTable::ReadMemo(sal_Size nBlockNo, ORowSetValue& aVariable)
|
||||||
{
|
{
|
||||||
SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::ReadMemo" );
|
SAL_INFO( "connectivity.drivers", "dbase Ocke.Janssen@sun.com ODbaseTable::ReadMemo" );
|
||||||
bool bIsText = true;
|
bool bIsText = true;
|
||||||
@@ -2768,7 +2768,7 @@ sal_Bool ODbaseTable::WriteBuffer()
|
|||||||
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
|
OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
|
||||||
|
|
||||||
// postion on desired record:
|
// postion on desired record:
|
||||||
long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
|
sal_Size nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
|
||||||
m_pFileStream->Seek(nPos);
|
m_pFileStream->Seek(nPos);
|
||||||
return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0;
|
return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0;
|
||||||
}
|
}
|
||||||
|
@@ -859,7 +859,7 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage&
|
|||||||
memset(aEmptyData,0x00,DINDEX_PAGE_SIZE);
|
memset(aEmptyData,0x00,DINDEX_PAGE_SIZE);
|
||||||
rStream.Write((sal_uInt8*)aEmptyData,DINDEX_PAGE_SIZE);
|
rStream.Write((sal_uInt8*)aEmptyData,DINDEX_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE);
|
sal_Size nCurrentPos = rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE);
|
||||||
OSL_UNUSED( nCurrentPos );
|
OSL_UNUSED( nCurrentPos );
|
||||||
|
|
||||||
nValue = rPage.nCount;
|
nValue = rPage.nCount;
|
||||||
@@ -873,9 +873,9 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage&
|
|||||||
// check if we have to fill the stream with '\0'
|
// check if we have to fill the stream with '\0'
|
||||||
if(i < rPage.rIndex.getHeader().db_maxkeys)
|
if(i < rPage.rIndex.getHeader().db_maxkeys)
|
||||||
{
|
{
|
||||||
sal_uIntPtr nTell = rStream.Tell() % DINDEX_PAGE_SIZE;
|
sal_Size nTell = rStream.Tell() % DINDEX_PAGE_SIZE;
|
||||||
sal_uInt16 nBufferSize = rStream.GetBufferSize();
|
sal_uInt16 nBufferSize = rStream.GetBufferSize();
|
||||||
sal_uIntPtr nRemainSize = nBufferSize - nTell;
|
sal_Size nRemainSize = nBufferSize - nTell;
|
||||||
if ( nRemainSize <= nBufferSize )
|
if ( nRemainSize <= nBufferSize )
|
||||||
{
|
{
|
||||||
char* pEmptyData = new char[nRemainSize];
|
char* pEmptyData = new char[nRemainSize];
|
||||||
|
@@ -456,7 +456,7 @@ void OFlatTable::construct()
|
|||||||
if(m_pFileStream)
|
if(m_pFileStream)
|
||||||
{
|
{
|
||||||
m_pFileStream->Seek(STREAM_SEEK_TO_END);
|
m_pFileStream->Seek(STREAM_SEEK_TO_END);
|
||||||
sal_Int32 nSize = m_pFileStream->Tell();
|
sal_Size nSize = m_pFileStream->Tell();
|
||||||
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
|
m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN);
|
||||||
|
|
||||||
// Buffersize is dependent on the file-size
|
// Buffersize is dependent on the file-size
|
||||||
@@ -927,7 +927,7 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (pStartPos)
|
if (pStartPos)
|
||||||
*pStartPos = m_pFileStream->Tell();
|
*pStartPos = (sal_Int32)m_pFileStream->Tell();
|
||||||
m_pFileStream->ReadByteStringLine(m_aCurrentLine, nEncoding);
|
m_pFileStream->ReadByteStringLine(m_aCurrentLine, nEncoding);
|
||||||
if (m_pFileStream->IsEof())
|
if (m_pFileStream->IsEof())
|
||||||
return false;
|
return false;
|
||||||
@@ -949,7 +949,7 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos
|
|||||||
while(nonEmpty && m_aCurrentLine.Len() == 0);
|
while(nonEmpty && m_aCurrentLine.Len() == 0);
|
||||||
|
|
||||||
if(pEndPos)
|
if(pEndPos)
|
||||||
*pEndPos = m_pFileStream->Tell();
|
*pEndPos = (sal_Int32)m_pFileStream->Tell();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -100,9 +100,9 @@ namespace connectivity
|
|||||||
sal_Bool CreateMemoFile(const INetURLObject& aFile);
|
sal_Bool CreateMemoFile(const INetURLObject& aFile);
|
||||||
sal_Bool HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;}
|
sal_Bool HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;}
|
||||||
sal_Bool ReadMemoHeader();
|
sal_Bool ReadMemoHeader();
|
||||||
sal_Bool ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable);
|
sal_Bool ReadMemo(sal_Size nBlockNo, ORowSetValue& aVariable);
|
||||||
|
|
||||||
sal_Bool WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlockNr);
|
sal_Bool WriteMemo(const ORowSetValue& aVariable, sal_Size& rBlockNr);
|
||||||
sal_Bool WriteBuffer();
|
sal_Bool WriteBuffer();
|
||||||
sal_Bool UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols, bool bForceAllFields);
|
sal_Bool UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols, bool bForceAllFields);
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos);
|
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos);
|
||||||
|
Reference in New Issue
Block a user