[Libreoffice-commits] core.git: connectivity/source

Norbert Thiebaud nthiebaud at gmail.com
Mon Feb 24 20:42:56 PST 2014


 connectivity/source/drivers/dbase/DTable.cxx     |   38 +++++++++++------------
 connectivity/source/drivers/dbase/dindexnode.cxx |    6 +--
 connectivity/source/drivers/flat/ETable.cxx      |    6 +--
 connectivity/source/inc/dbase/DTable.hxx         |    4 +-
 4 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit d9cd3dc9aa0424753c5ed277baa76d15511fef77
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Feb 24 21:05:01 2014 -0600

    connectivity: harmonize types relatated to Tell()/Seek()
    
    Change-Id: I032f6d32b151203e62b23bffaf25dbc4aeb5ae8a
    Reviewed-on: https://gerrit.libreoffice.org/8217
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 4dfb402..5bdb87d 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -78,9 +78,9 @@ using namespace ::com::sun::star::i18n;
 
 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.SeekRel(-1);
     char cEOL;
@@ -526,7 +526,7 @@ void ODbaseTable::construct()
         }
         fillColumns();
 
-        sal_uInt32 nFileSize = lcl_getFileSize(*m_pFileStream);
+        sal_Size nFileSize = lcl_getFileSize(*m_pFileStream);
         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
             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:
     // ... 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 );
     if ( bInsertRow )
     {
-        sal_uInt32 nFileSize = 0, nMemoFileSize = 0;
+        sal_Size nFileSize = 0, nMemoFileSize = 0;
 
         nFileSize = lcl_getFileSize(*m_pFileStream);
 
@@ -1553,11 +1553,11 @@ sal_Bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,con
     AllocBuffer();
 
     // 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->Read((char*)m_pBuffer, m_aHeader.db_slng);
 
-    sal_uInt32 nMemoFileSize( 0 );
+    sal_Size nMemoFileSize( 0 );
     if (HasMemoFields() && m_pMemoStream)
     {
         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 at sun.com ODbaseTable::DeleteRow" );
     // Set the Delete-Flag (be it set or not):
     // 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);
 
     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
                     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:
                     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 at sun.com ODbaseTable::WriteMemo" );
     // if the BlockNo 0 is given, the block will be appended at the end
-    sal_uIntPtr nSize = 0;
+    sal_Size nSize = 0;
     OString aStr;
     ::com::sun::star::uno::Sequence<sal_Int8> aValue;
     sal_uInt8 nHeader[4];
@@ -2038,7 +2038,7 @@ sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlo
                 m_pMemoStream->SeekRel(4L);
                 m_pMemoStream->Read(sHeader,4);
 
-                sal_uIntPtr nOldSize;
+                sal_Size nOldSize;
                 if (m_aMemoHeader.db_typ == MemoFoxPro)
                     nOldSize = ((((unsigned char)sHeader[0]) * 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;
 
                 // 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);
                 bAppend = nUsedBlocks > nOldUsedBlocks;
             }
@@ -2060,7 +2060,7 @@ sal_Bool ODbaseTable::WriteMemo(const ORowSetValue& aVariable, sal_uIntPtr& rBlo
 
     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
         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
     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);
 
         // 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;
 
         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);
         if (m_pFileStream->GetError() != ERRCODE_NONE)
@@ -2665,7 +2665,7 @@ End:
     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 at sun.com ODbaseTable::ReadMemo" );
     bool bIsText = true;
@@ -2768,7 +2768,7 @@ sal_Bool ODbaseTable::WriteBuffer()
     OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position");
 
     // 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);
     return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0;
 }
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index 25da53c..04d5fed 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -859,7 +859,7 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage&
         memset(aEmptyData,0x00,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 );
 
     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'
     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_uIntPtr nRemainSize = nBufferSize - nTell;
+        sal_Size nRemainSize = nBufferSize - nTell;
         if ( nRemainSize <= nBufferSize )
         {
             char* pEmptyData = new char[nRemainSize];
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index c11b23f..8a610d2 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -456,7 +456,7 @@ void OFlatTable::construct()
     if(m_pFileStream)
     {
         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);
 
         // Buffersize is dependent on the file-size
@@ -927,7 +927,7 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos
     do
     {
         if (pStartPos)
-            *pStartPos = m_pFileStream->Tell();
+            *pStartPos = (sal_Int32)m_pFileStream->Tell();
         m_pFileStream->ReadByteStringLine(m_aCurrentLine, nEncoding);
         if (m_pFileStream->IsEof())
             return false;
@@ -949,7 +949,7 @@ bool OFlatTable::readLine(sal_Int32 * const pEndPos, sal_Int32 * const pStartPos
     while(nonEmpty && m_aCurrentLine.Len() == 0);
 
     if(pEndPos)
-        *pEndPos = m_pFileStream->Tell();
+        *pEndPos = (sal_Int32)m_pFileStream->Tell();
     return true;
 }
 
diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx
index 2a00c51..be5f691 100644
--- a/connectivity/source/inc/dbase/DTable.hxx
+++ b/connectivity/source/inc/dbase/DTable.hxx
@@ -100,9 +100,9 @@ namespace connectivity
             sal_Bool CreateMemoFile(const INetURLObject& aFile);
             sal_Bool HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;}
             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 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);


More information about the Libreoffice-commits mailing list