WaE: "PAGE_SIZE" redefined

No wonder such a generic-sounding term is defined in some system header, like
in the Android NDK's <asm/page.h>.

Change-Id: Id813afb836d358a3749a8a9fb1c9fb162f881c04
This commit is contained in:
Tor Lillqvist
2012-12-29 01:06:38 +02:00
parent 9f82a20777
commit 11ce98e1b9
4 changed files with 17 additions and 17 deletions

View File

@@ -150,7 +150,7 @@ sal_Bool ODbaseIndex::openIndexFile()
if(m_pFileStream) if(m_pFileStream)
{ {
m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
m_pFileStream->SetBufferSize(PAGE_SIZE); m_pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
(*m_pFileStream) >> *this; (*m_pFileStream) >> *this;
} }
} }
@@ -349,7 +349,7 @@ ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, sal_Bo
SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rIndex) SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rIndex)
{ {
rStream.Seek(0); rStream.Seek(0);
rStream.Read(&rIndex.m_aHeader,PAGE_SIZE); rStream.Read(&rIndex.m_aHeader,DINDEX_PAGE_SIZE);
rIndex.m_nRootPage = rIndex.m_aHeader.db_rootpage; rIndex.m_nRootPage = rIndex.m_aHeader.db_rootpage;
rIndex.m_nPageCount = rIndex.m_aHeader.db_pagecount; rIndex.m_nPageCount = rIndex.m_aHeader.db_pagecount;
@@ -359,7 +359,7 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rInd
SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rIndex) SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rIndex)
{ {
rStream.Seek(0); rStream.Seek(0);
OSL_VERIFY_EQUALS( rStream.Write(&rIndex.m_aHeader,PAGE_SIZE), PAGE_SIZE, "Write not successful: Wrong header size for dbase index!"); OSL_VERIFY_EQUALS( rStream.Write(&rIndex.m_aHeader,DINDEX_PAGE_SIZE), DINDEX_PAGE_SIZE, "Write not successful: Wrong header size for dbase index!");
return rStream; return rStream;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@@ -496,7 +496,7 @@ sal_Bool ODbaseIndex::CreateImpl()
} }
m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
m_pFileStream->SetBufferSize(PAGE_SIZE); m_pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
// firstly the result must be sorted // firstly the result must be sorted
utl::SharedUNOComponent<XStatement> xStmt; utl::SharedUNOComponent<XStatement> xStmt;
@@ -545,13 +545,13 @@ sal_Bool ODbaseIndex::CreateImpl()
m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1; m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1;
m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (sal_uInt16)getINT32(xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (sal_uInt16)getINT32(xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
m_aHeader.db_keylen = (( m_aHeader.db_keylen - 1) / 4 + 1) * 4; m_aHeader.db_keylen = (( m_aHeader.db_keylen - 1) / 4 + 1) * 4;
m_aHeader.db_maxkeys = (PAGE_SIZE - 4) / (8 + m_aHeader.db_keylen); m_aHeader.db_maxkeys = (DINDEX_PAGE_SIZE - 4) / (8 + m_aHeader.db_keylen);
if ( m_aHeader.db_maxkeys < 3 ) if ( m_aHeader.db_maxkeys < 3 )
{ {
impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX_KEYSIZE,sFile); impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX_KEYSIZE,sFile);
} }
m_pFileStream->SetStreamSize(PAGE_SIZE); m_pFileStream->SetStreamSize(DINDEX_PAGE_SIZE);
rtl::OString aCol(rtl::OUStringToOString(aName, m_pTable->getConnection()->getTextEncoding())); rtl::OString aCol(rtl::OUStringToOString(aName, m_pTable->getConnection()->getTextEncoding()));
strncpy(m_aHeader.db_name, aCol.getStr(), std::min<size_t>(sizeof(m_aHeader.db_name), aCol.getLength())); strncpy(m_aHeader.db_name, aCol.getStr(), std::min<size_t>(sizeof(m_aHeader.db_name), aCol.getLength()));

View File

@@ -57,11 +57,11 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const ::rtl::OUString& _rName)
if(pFileStream) if(pFileStream)
{ {
pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
pFileStream->SetBufferSize(PAGE_SIZE); pFileStream->SetBufferSize(DINDEX_PAGE_SIZE);
ODbaseIndex::NDXHeader aHeader; ODbaseIndex::NDXHeader aHeader;
pFileStream->Seek(0); pFileStream->Seek(0);
pFileStream->Read(&aHeader,PAGE_SIZE); pFileStream->Read(&aHeader,DINDEX_PAGE_SIZE);
delete pFileStream; delete pFileStream;
ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName); ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);

View File

@@ -834,7 +834,7 @@ static sal_uInt32 nValue;
//------------------------------------------------------------------ //------------------------------------------------------------------
SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage)
{ {
rStream.Seek(rPage.GetPagePos() * PAGE_SIZE); rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE);
rStream >> nValue >> rPage.aChild; rStream >> nValue >> rPage.aChild;
rPage.nCount = sal_uInt16(nValue); rPage.nCount = sal_uInt16(nValue);
@@ -847,17 +847,17 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage)
SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage)
{ {
// Page doesn't exist yet // Page doesn't exist yet
sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * PAGE_SIZE; sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * DINDEX_PAGE_SIZE;
if (nSize > rStream.Seek(STREAM_SEEK_TO_END)) if (nSize > rStream.Seek(STREAM_SEEK_TO_END))
{ {
rStream.SetStreamSize(nSize); rStream.SetStreamSize(nSize);
rStream.Seek(rPage.GetPagePos() * PAGE_SIZE); rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE);
char aEmptyData[PAGE_SIZE]; char aEmptyData[DINDEX_PAGE_SIZE];
memset(aEmptyData,0x00,PAGE_SIZE); memset(aEmptyData,0x00,DINDEX_PAGE_SIZE);
rStream.Write((sal_uInt8*)aEmptyData,PAGE_SIZE); rStream.Write((sal_uInt8*)aEmptyData,DINDEX_PAGE_SIZE);
} }
sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * PAGE_SIZE); sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE);
OSL_UNUSED( nCurrentPos ); OSL_UNUSED( nCurrentPos );
nValue = rPage.nCount; nValue = rPage.nCount;
@@ -870,7 +870,7 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r
// 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() % PAGE_SIZE; sal_uIntPtr nTell = rStream.Tell() % DINDEX_PAGE_SIZE;
sal_uInt16 nBufferSize = rStream.GetBufferSize(); sal_uInt16 nBufferSize = rStream.GetBufferSize();
sal_uIntPtr nRemainSize = nBufferSize - nTell; sal_uIntPtr nRemainSize = nBufferSize - nTell;
if ( nRemainSize <= nBufferSize ) if ( nRemainSize <= nBufferSize )

View File

@@ -26,7 +26,7 @@
#include <tools/ref.hxx> #include <tools/ref.hxx>
#define NODE_NOTFOUND 0xFFFF #define NODE_NOTFOUND 0xFFFF
#define PAGE_SIZE 512 #define DINDEX_PAGE_SIZE 512
namespace connectivity namespace connectivity
{ {