Kaydet (Commit) 52e69bfb authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:unusedmethods unused return value in lotuswordpro

Change-Id: Ibed85be78e05dc0e6474d688ef0e0dea401758ac
üst 602a6493
......@@ -108,7 +108,7 @@ LtcBenContainer::Open() // delete two inputs
return BenErr_OK;
}
BenError
void
LtcBenContainer::RegisterPropertyName(const char * sPropertyName,
pCBenPropertyName * ppPropertyName)
{
......@@ -119,21 +119,19 @@ LtcBenContainer::RegisterPropertyName(const char * sPropertyName,
if (pNamedObject != nullptr)
{
if (! pNamedObject->IsPropertyName())
return BenErr_NameConflict;
return;
else *ppPropertyName = static_cast<pCBenPropertyName>(pNamedObject);
}
else
{
pCUtListElmt pPrevObject;
if (FindID(&cObjects, cNextAvailObjectID, &pPrevObject) != nullptr)
return BenErr_DuplicateObjectID;
return;
*ppPropertyName = new CBenPropertyName(this, cNextAvailObjectID,
static_cast<pCBenObject>(pPrevObject), sPropertyName, pPrevNamedObjectListElmt);
++cNextAvailObjectID;
}
return BenErr_OK;
}
pCBenObject
......@@ -286,14 +284,13 @@ sal_uInt32 GetSvStreamSize(SvStream * pStream)
/**
* Find hazily according to object ID
* @param pObjectname - format as "GrXX,XXXXXXXX" wherein XX is high part of object ID, and XXXXXXXX is low part
* @return the value stream pointers with the property names
*/
BenError LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObjectName)
void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObjectName)
{
if (!pObjectName)
{
pStream = nullptr;
return BenErr_NamedObjectError;
return;
}
// construct the string of property name
char sSName[64]="";
......@@ -326,7 +323,7 @@ BenError LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *p
if (nLen <= 0)
{
pStream = nullptr;
return BenErr_NamedObjectError;
return;
}
char * pBuf = new char[nLen];
......@@ -348,7 +345,6 @@ BenError LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *p
assert(pMemStream != nullptr);
pStream = pMemStream;
return BenErr_OK;
}
}// end namespace OpenStormBento
......
......@@ -202,7 +202,7 @@ class LtcBenContainer
{
public:
BenError Open();
BenError RegisterPropertyName(const char * sPropertyName,
void RegisterPropertyName(const char * sPropertyName,
pCBenPropertyName * ppPropertyName);
// Pass NULL to begin iteration. Done when returns NULL.
// Objects are returned in order of increasing ID
......@@ -226,7 +226,7 @@ public: // Internal methods
LtcUtBenValueStream * FindNextValueStreamWithPropertyName(const char * sPropertyName, LtcUtBenValueStream * pCurrentValueStream);
LtcUtBenValueStream * FindValueStreamWithPropertyName(const char * sPropertyName);
BenError CreateGraphicStream(SvStream * &pStream, const char *pObjectName);
void CreateGraphicStream(SvStream * &pStream, const char *pObjectName);
BenError GetSize(sal_uLong * pLength);
private: // Data
......@@ -258,7 +258,7 @@ class CBenValue : public CBenIDListElmt
{
public:
unsigned long GetValueSize();
BenError ReadValueData(void * pBuffer,
void ReadValueData(void * pBuffer,
unsigned long Offset, unsigned long MaxSize, unsigned long * pAmtRead);
pCBenProperty BEN_EXPORT GetProperty() { return cpProperty; }
......
......@@ -68,7 +68,7 @@ CBenValue::GetValueSize()
return Size;
}
BenError
void
CBenValue::ReadValueData(void * pReadBuffer, unsigned long Offset,
unsigned long Amt, unsigned long * pAmtRead)
{
......@@ -89,7 +89,7 @@ CBenValue::ReadValueData(void * pReadBuffer, unsigned long Offset,
while ((pCurrSeg = GetNextValueSegment(pCurrSeg)) != nullptr)
{
if (Amt == 0) /// whole buffer is full now, so return
return BenErr_OK;
return;
if (SegOffset <= Offset && Offset < SegOffset + pCurrSeg->GetSize()) /// begin at current segment
{
......@@ -110,17 +110,17 @@ CBenValue::ReadValueData(void * pReadBuffer, unsigned long Offset,
{
if ((Err = pContainer->SeekToPosition(pCurrSeg->GetPosition() +
OffsetIntoSeg)) != BenErr_OK)
return Err;
return;
if ((Err = pContainer->Read(pBuffer, AmtThisSeg,
&AmtReadThisSeg)) != BenErr_OK)
return Err;
return;
}
*pAmtRead += AmtReadThisSeg;
if (AmtThisSeg != AmtReadThisSeg)
return BenErr_UnexpectedEndOfFile;
return;
pBuffer += AmtReadThisSeg;
Offset += AmtReadThisSeg;
......@@ -129,7 +129,6 @@ CBenValue::ReadValueData(void * pReadBuffer, unsigned long Offset,
SegOffset += pCurrSeg->GetSize();
}
return BenErr_OK;
}
}//end namespace OpenStormBento
......
......@@ -67,28 +67,20 @@ LwpFileHeader::LwpFileHeader()
/**
* @descr read file header object from svstream
*/
sal_uInt32 LwpFileHeader::Read(LwpSvStream *pStrm)
void LwpFileHeader::Read(LwpSvStream *pStrm)
{
sal_uInt32 len = 0;
pStrm->ReadUInt16( m_nAppRevision );
len += sizeof(m_nAppRevision);
pStrm->ReadUInt16( m_nFileRevision );
len += sizeof(m_nFileRevision);
pStrm->ReadUInt16( m_nAppReleaseNo );
len += sizeof(m_nAppReleaseNo);
pStrm->ReadUInt16( m_nRequiredAppRevision );
len += sizeof(m_nRequiredAppRevision);
pStrm->ReadUInt16( m_nRequiredFileRevision );
len += sizeof(m_nRequiredFileRevision);
len += m_cDocumentID.Read(pStrm);
m_cDocumentID.Read(pStrm);
if (m_nFileRevision < 0x000B)
m_nRootIndexOffset = BAD_OFFSET;
else
{
pStrm->ReadUInt32( m_nRootIndexOffset );
len += sizeof(m_nRootIndexOffset);
}
return len;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -74,7 +74,7 @@ private: //data member
sal_uInt32 m_nRootIndexOffset;
public:
static sal_uInt16 m_nFileRevision;
sal_uInt32 Read(LwpSvStream *pStrm);
void Read(LwpSvStream *pStrm);
sal_uInt32 GetRootIndexOffset();
LwpObjectID& GetDocID();
};
......
......@@ -515,14 +515,13 @@ VO_PARASTYLE/VO_CHARACTERSTYLE call this method to add its created style to XFSt
Prerequisite: pStyle has been created and all properties has been set to it.
Return the XFStyle* added by XFStyleManager
*/
IXFStyle* LwpStyleManager::AddStyle(LwpObjectID styleObjID, IXFStyle* pStyle)
void LwpStyleManager::AddStyle(LwpObjectID styleObjID, IXFStyle* pStyle)
{
assert(pStyle);
//pStyle may change if same style is found in XFStyleManager
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
pStyle = pXFStyleManager->AddStyle(pStyle).m_pStyle;
m_StyleList.insert(LwpStyleMap::value_type(styleObjID, pStyle));
return pStyle;
}
/*
......
......@@ -308,7 +308,7 @@ private:
LwpStyleMap m_StyleList;
public:
void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;}
IXFStyle* AddStyle(LwpObjectID styleObjID, IXFStyle* pStyle);
void AddStyle(LwpObjectID styleObjID, IXFStyle* pStyle);
IXFStyle* GetStyle(const LwpObjectID &styleObjID);
};
#endif
......
......@@ -242,7 +242,7 @@ LwpMasterPage::LwpMasterPage(LwpPara* pPara, LwpPageLayout* pLayout)
* @descr: Register master page style for para style and register section style if necessary
*
*/
bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
void LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
{
//if there is no other frib after current frib, register master page in starting para of next page
LwpStory* pStory = nullptr;
......@@ -253,7 +253,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
{
pStory->SetCurrentLayout(m_pLayout);
RegisterFillerPageStyle();
return false;
return;
}
m_bNewSection = false;
......@@ -301,7 +301,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
//register tab style;
pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
if (!pStory)
return false;
return;
pStory->SetTabLayout(m_pLayout);
m_pPara->RegisterTabStyle(pOverStyle);
......@@ -334,7 +334,6 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
//}
m_SectionStyleName = pXFStyleManager->AddStyle(pSectStyle).m_pStyle->GetStyleName();
}
return false;
}
/**
......
......@@ -76,7 +76,7 @@ public:
public:
//for page layout register and parse
bool RegisterMasterPage(LwpFrib* pFrib);
void RegisterMasterPage(LwpFrib* pFrib);
void RegisterFillerPageStyle();
void ParseSection(LwpFrib* pFrib);
XFSection* CreateXFSection();
......
......@@ -91,13 +91,14 @@ sal_uInt32 LwpObjectID::Read(LwpObjectStream *pObj)
* if index>0, lowid is get from time table per the index
* else index+lowid+highid
*/
sal_uInt32 LwpObjectID::ReadIndexed(LwpSvStream *pStrm)
void LwpObjectID::ReadIndexed(LwpSvStream *pStrm)
{
//note the m_nLow store the index instead of time from the timetable as in LWP
m_bIsCompressed = false;
if( LwpFileHeader::m_nFileRevision < 0x000B)
{
return Read(pStrm);
Read(pStrm);
return;
}
pStrm->ReadUInt8( m_nIndex );
......@@ -116,7 +117,7 @@ sal_uInt32 LwpObjectID::ReadIndexed(LwpSvStream *pStrm)
pStrm->ReadUInt32( m_nLow );
}
pStrm->ReadUInt16( m_nHigh );
return DiskSizeIndexed();
DiskSizeIndexed();
}
/**
......@@ -153,21 +154,19 @@ sal_uInt32 LwpObjectID::ReadIndexed(LwpObjectStream *pStrm)
* else lowid equals to the lowid of previous low id
* and high id = the high id of previous id + diff +1
*/
sal_uInt32 LwpObjectID::ReadCompressed( LwpObjectStream* pObj, LwpObjectID &prev )
void LwpObjectID::ReadCompressed( LwpObjectStream* pObj, LwpObjectID &prev )
{
sal_uInt8 diff = pObj->QuickReaduInt8();
sal_uInt32 len=1;
if (diff == 255)
{
len += Read(pObj);
Read(pObj);
}
else
{
m_nLow = prev.GetLow();
m_nHigh = prev.GetHigh() + diff +1;
}
return len;
}
/**
* @descr return the size of indexed object id
......
......@@ -86,9 +86,9 @@ private:
public:
sal_uInt32 Read( LwpSvStream *pStrm );
sal_uInt32 Read( LwpObjectStream *pStrm );
sal_uInt32 ReadIndexed( LwpSvStream* pStrm );
void ReadIndexed( LwpSvStream* pStrm );
sal_uInt32 ReadIndexed( LwpObjectStream *pStrm );
sal_uInt32 ReadCompressed( LwpObjectStream* pObj, LwpObjectID& prev );
void ReadCompressed( LwpObjectStream* pObj, LwpObjectID& prev );
/**
* @descr return the size of object id with format: low(4bytes)+high(2bytes)
......
......@@ -191,14 +191,12 @@ void LwpObjectStream::SeekRel(sal_uInt16 pos)
/**
* @descr Seek to pos in object buffer/buffer
*/
bool LwpObjectStream::Seek( sal_uInt16 pos)
void LwpObjectStream::Seek( sal_uInt16 pos)
{
if (pos < m_nBufSize)
{
m_nReadPos = pos;
return true;
}
return false;
}
/**
......
......@@ -88,7 +88,7 @@ public:
sal_uInt16 QuickRead(void* buf, sal_uInt16 len);
sal_uInt16 GetPos() { return m_nReadPos; }
void SeekRel(sal_uInt16 pos);
bool Seek( sal_uInt16 pos);
void Seek( sal_uInt16 pos);
void SkipExtra();
sal_uInt16 CheckExtra();
......
......@@ -311,9 +311,8 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
AddBreakAfter(m_pXFContainer);
}
bool LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle)
void LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle)
{
bool bSuccess = false;
//get story
LwpStory* pStory = dynamic_cast<LwpStory*>(m_Story.obj().get());
//if pagelayout is modified, register the pagelayout
......@@ -326,7 +325,6 @@ bool LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle)
RegisterNewSectionStyle(pLayout);
}
bSuccess = true;
//register master page style
XFParaStyle* pOverStyle = new XFParaStyle();
*pOverStyle = *pBaseStyle;
......@@ -337,7 +335,6 @@ bool LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle)
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
m_StyleName = pXFStyleManager->AddStyle(pOverStyle).m_pStyle->GetStyleName();
}
return bSuccess;
}
/**
* @short register paragraph style
......
......@@ -275,7 +275,7 @@ private:
void OverrideParaBullet(LwpParaProperty* pProps);
void OverrideParaNumbering(LwpParaProperty* pProps);
bool RegisterMasterPage(XFParaStyle* pBaseStyle);
void RegisterMasterPage(XFParaStyle* pBaseStyle);
void RegisterNewSectionStyle(LwpPageLayout* pLayout);
void ParseDropcapContent();
......
......@@ -92,9 +92,9 @@ LwpSvStream& LwpSvStream::ReadUInt32( sal_uInt32& rUInt32 )
/**
* @descr SeekRel in stream
*/
sal_Int64 LwpSvStream::SeekRel(sal_Int64 pos)
void LwpSvStream::SeekRel(sal_Int64 pos)
{
return m_pStream->SeekRel(pos);
m_pStream->SeekRel(pos);
}
/**
* @descr Get the current position in stream
......
......@@ -69,7 +69,7 @@ class LwpSvStream
public:
LwpSvStream(SvStream* pStream, LwpSvStream * pCompressed = nullptr);
sal_Int32 Read( void* bytes, sal_Int32 nBytesToRead );
sal_Int64 SeekRel( sal_Int64 pos );
void SeekRel( sal_Int64 pos );
sal_Int64 Tell();
sal_Int64 Seek( sal_Int64 pos );
......
......@@ -93,19 +93,17 @@ LwpFormulaInfo::~LwpFormulaInfo()
}
}
bool LwpFormulaInfo::ReadConst()
void LwpFormulaInfo::ReadConst()
{
double Constant = m_pObjStrm->QuickReadDouble();
m_aStack.push_back( new LwpFormulaConst(Constant) );
return true;
}
/**
* Need more effort for unicode.
*/
bool LwpFormulaInfo::ReadText()
void LwpFormulaInfo::ReadText()
{
m_pObjStrm->QuickReadInt16(); //Disk Size
sal_uInt16 nStrLen = m_pObjStrm->QuickReadInt16();
......@@ -119,7 +117,6 @@ bool LwpFormulaInfo::ReadText()
aText += "\"";
m_aStack.push_back(new LwpFormulaText(aText));
return true;
}
bool LwpFormulaInfo::ReadCellID()
......@@ -162,10 +159,9 @@ bool LwpFormulaInfo::ReadCellRange()
/**
* Read expression from wordpro file
*/
bool LwpFormulaInfo::ReadExpression()
void LwpFormulaInfo::ReadExpression()
{
sal_uInt16 TokenType, DiskLength;
bool readSucceeded = true;
/* Read the compiled expression length */
m_pObjStrm->SeekRel(2);
......@@ -189,12 +185,11 @@ bool LwpFormulaInfo::ReadExpression()
}
case TK_CELLID:
if (!ReadCellID())
readSucceeded = false;
ReadCellID();
break;
case TK_CELLRANGE:
readSucceeded = ReadCellRange();
ReadCellRange();
break;
case TK_SUM:
......@@ -205,8 +200,7 @@ bool LwpFormulaInfo::ReadExpression()
case TK_AVERAGE:
{
LwpFormulaFunc* pFunc = new LwpFormulaFunc(TokenType);
if (!ReadArguments(*pFunc))
readSucceeded = false;
ReadArguments(*pFunc);
m_aStack.push_back(pFunc);
}
break;
......@@ -233,10 +227,6 @@ bool LwpFormulaInfo::ReadExpression()
pOp->AddArg(m_aStack.back()); m_aStack.pop_back();
m_aStack.push_back(pOp);
}
else
{
readSucceeded = false;
}
break;
case TK_UNARY_MINUS:
if (!m_aStack.empty())
......@@ -245,20 +235,14 @@ bool LwpFormulaInfo::ReadExpression()
pOp->AddArg(m_aStack.back()); m_aStack.pop_back();
m_aStack.push_back(pOp);
}
else
{
readSucceeded = false;
}
break;
default:
// We don't know what to do with this token, so eat it.
m_pObjStrm->SeekRel(DiskLength);
readSucceeded = false;
break;
}
MarkUnsupported(TokenType);
}
return readSucceeded;
}
void LwpFormulaInfo::MarkUnsupported(sal_uInt16 TokenType)
......
......@@ -200,16 +200,16 @@ public:
protected:
void Read() override;
bool ReadCellID();
bool ReadText();
void ReadText();
bool ReadCellRange();
bool ReadExpression();
void ReadExpression();
bool ReadArguments(LwpFormulaFunc& aFunc);
bool m_bSupported;
private:
virtual ~LwpFormulaInfo();
std::vector<LwpFormulaArg*> m_aStack;
bool ReadConst();
void ReadConst();
void MarkUnsupported(sal_uInt16 TokenType);
sal_uInt16 m_nFormulaRow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment