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

loplugin:unusedmethods unused return value in hwpfilter

Change-Id: Ib225db89e60708f6b55b3cb86f8e881386fab86f
üst 0f3a3c38
......@@ -568,10 +568,10 @@ void Formula::makeBlock(Node *res)
#endif
}
int Formula::parse()
void Formula::parse()
{
Node *res = nullptr;
if( !eq ) return 0;
if( !eq ) return;
if( isHwpEQ ){
MzString a;
// fprintf(stderr,"\n\n[BEFORE]\n[%s]\n",eq);
......@@ -627,8 +627,6 @@ int Formula::parse()
nodelist.pop_front();
delete tmpNode;
}
return 0;
}
void Formula::trim()
......
......@@ -55,7 +55,7 @@ public:
pList = p;
rList = static_cast<XAttributeList *>(pList);
}
int parse();
void parse();
private:
void trim();
void makeMathML(Node *res);
......
......@@ -43,18 +43,17 @@ HWPFont::~HWPFont()
}
int HWPFont::AddFont(int lang, const char *font)
void HWPFont::AddFont(int lang, const char *font)
{
int nfonts;
if (!(lang >= 0 && lang < NLanguage))
return 0;
return;
nfonts = nFonts[lang];
if (MAXFONTS <= nfonts)
return 0;
return;
strncpy(fontnames[lang] + FONTNAMELEN * nfonts, font, FONTNAMELEN - 1);
nFonts[lang]++;
return nfonts;
}
......
......@@ -54,7 +54,7 @@ class DLLEXPORT HWPFont
* @param lang Language index
* @param font Name of font family
*/
int AddFont( int lang, const char *font );
void AddFont( int lang, const char *font );
/**
* @param lang Language index
* @param id Index of font
......
......@@ -197,24 +197,24 @@ bool HWPSummary::Read(HWPFile & hwpf)
}
bool ParaShape::Read(HWPFile & hwpf)
void ParaShape::Read(HWPFile & hwpf)
{
pagebreak = 0;
unsigned short tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
left_margin = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
right_margin = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
indent = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
lspacing = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
pspacing_next = tmp16;
hwpf.Read1b(&condense, 1);
......@@ -224,37 +224,36 @@ bool ParaShape::Read(HWPFile & hwpf)
hwpf.Read1b(&tabs[ii].type, 1);
hwpf.Read1b(&tabs[ii].dot_continue, 1);
if (!hwpf.Read2b(tmp16))
return false;
return;
tabs[ii].position = tmp16;
}
hwpf.Read1b(&coldef.ncols, 1);
hwpf.Read1b(&coldef.separator, 1);
if (!hwpf.Read2b(tmp16))
return false;
return;
coldef.spacing = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
coldef.columnlen = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
coldef.columnlen0 = tmp16;
hwpf.Read1b(&shade, 1);
hwpf.Read1b(&outline, 1);
hwpf.Read1b(&outline_continue, 1);
if (!hwpf.Read2b(tmp16))
return false;
return;
pspacing_prev = tmp16;
hwpf.Read1b(reserved, 2);
return (!hwpf.State());
}
bool CharShape::Read(HWPFile & hwpf)
void CharShape::Read(HWPFile & hwpf)
{
unsigned short tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
size = tmp16;
hwpf.Read1b(font, NLanguage);
hwpf.Read1b(ratio, NLanguage);
......@@ -263,8 +262,6 @@ bool CharShape::Read(HWPFile & hwpf)
hwpf.Read1b(&shade, 1);
hwpf.Read1b(&attr, 1);
hwpf.Read1b(reserved, 4);
return (!hwpf.State());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -231,7 +231,7 @@ struct CharShape
unsigned char attr;
unsigned char reserved[4];
bool Read(HWPFile &);
void Read(HWPFile &);
};
/* ?? ?????? ???? ?????? */
......@@ -284,7 +284,7 @@ struct ParaShape
CharShape *cshape;
unsigned char pagebreak;
bool Read(HWPFile &);
void Read(HWPFile &);
// virtual ~ParaShape();
};
#endif // INCLUDED_HWPFILTER_SOURCE_HINFO_H
......
......@@ -29,29 +29,29 @@
#include "hbox.h"
#include "hutil.h"
bool LineInfo::Read(HWPFile & hwpf, HWPPara *pPara)
void LineInfo::Read(HWPFile & hwpf, HWPPara *pPara)
{
if (!hwpf.Read2b(pos))
return false;
return;
unsigned short tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
space_width = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
height = tmp16;
// internal information
if (!hwpf.Read2b(tmp16))
return false;
return;
pgy = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
sx = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
psx = tmp16;
if (!hwpf.Read2b(tmp16))
return false;
return;
pex = tmp16;
height_sp = 0;
......@@ -62,8 +62,6 @@ bool LineInfo::Read(HWPFile & hwpf, HWPPara *pPara)
pPara->pshape.reserved[0] = sal::static_int_cast<unsigned char>(pex & 0x01);
pPara->pshape.reserved[1] = sal::static_int_cast<unsigned char>(pex & 0x02);
}
return (!hwpf.State());
}
HWPPara::HWPPara()
......
......@@ -68,7 +68,7 @@ struct LineInfo
hunit height_sp;
unsigned short softbreak; // column, page, section
bool Read(HWPFile &hwpf, HWPPara *para);
void Read(HWPFile &hwpf, HWPPara *para);
};
/**
* It represents the paragraph.
......
......@@ -25,7 +25,7 @@
#include "hwpfile.h"
#include "htags.h"
bool HyperText::Read(HWPFile & hwpf)
void HyperText::Read(HWPFile & hwpf)
{
hwpf.Read1b(filename, 256);
hwpf.Read2b(bookmark, 16);
......@@ -41,7 +41,6 @@ bool HyperText::Read(HWPFile & hwpf)
break;
}
}
return true;
}
......@@ -101,21 +100,21 @@ OlePicture::~OlePicture()
#define FILESTG_SIGNATURE_NORMAL 0xF8995568
bool OlePicture::Read(HWPFile & hwpf)
void OlePicture::Read(HWPFile & hwpf)
{
if (size <= 0)
return false;
return;
// We process only FILESTG_SIGNATURE_NORMAL.
hwpf.Read4b(&signature, 1);
if (signature != FILESTG_SIGNATURE_NORMAL)
return false;
return;
#ifdef WIN32
char *data = new char[size];
if (hwpf.ReadBlock(data,size) == 0)
{
delete [] data;
return false;
return;
}
FILE *fp;
char tname[200];
......@@ -124,7 +123,7 @@ bool OlePicture::Read(HWPFile & hwpf)
if (0 == (fp = fopen(tname, "wb")))
{
delete [] data;
return false;
return;
}
fwrite(data, size, 1, fp);
delete [] data;
......@@ -135,15 +134,13 @@ bool OlePicture::Read(HWPFile & hwpf)
NULL, 0, &pis) != S_OK ) {
pis = 0;
unlink(tname);
return false;
return;
}
unlink(tname);
#else
if (pis == nullptr || hwpf.ReadBlock(pis, size) == 0)
return false;
return;
#endif
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -46,7 +46,7 @@ struct HyperText
char macro[325];
uchar type;
char reserve[3];
bool Read(HWPFile& hwpf);
void Read(HWPFile& hwpf);
};
/**
* @short Win32 OLE object
......@@ -63,7 +63,7 @@ struct OlePicture
explicit OlePicture(int tsize);
~OlePicture(void);
bool Read(HWPFile& hwpf);
void Read(HWPFile& hwpf);
};
#endif // INCLUDED_HWPFILTER_SOURCE_HTAGS_H
......
......@@ -176,15 +176,17 @@ int HWPFile::Read1b(void *ptr, size_t nmemb)
return hiodev ? hiodev->read1b(ptr, nmemb) : 0;
}
int HWPFile::Read2b(void *ptr, size_t nmemb)
void HWPFile::Read2b(void *ptr, size_t nmemb)
{
return hiodev ? hiodev->read2b(ptr, nmemb) : 0;
if (hiodev)
hiodev->read2b(ptr, nmemb);
}
int HWPFile::Read4b(void *ptr, size_t nmemb)
void HWPFile::Read4b(void *ptr, size_t nmemb)
{
return hiodev ? hiodev->read4b(ptr, nmemb) : 0;
if (hiodev)
hiodev->read4b(ptr, nmemb);
}
......@@ -200,9 +202,10 @@ size_t HWPFile::SkipBlock(size_t size)
}
bool HWPFile::SetCompressed(bool flag)
void HWPFile::SetCompressed(bool flag)
{
return hiodev && hiodev->setCompressed(flag);
if (hiodev)
hiodev->setCompressed(flag);
}
......@@ -218,27 +221,27 @@ HIODev *HWPFile::SetIODevice(HIODev * new_hiodev)
// end of HIODev wrapper
bool HWPFile::InfoRead()
void HWPFile::InfoRead()
{
return _hwpInfo.Read(*this);
_hwpInfo.Read(*this);
}
bool HWPFile::FontRead()
void HWPFile::FontRead()
{
return _hwpFont.Read(*this);
_hwpFont.Read(*this);
}
bool HWPFile::StyleRead()
void HWPFile::StyleRead()
{
return _hwpStyle.Read(*this);
_hwpStyle.Read(*this);
}
bool HWPFile::ParaListRead()
void HWPFile::ParaListRead()
{
return ReadParaList(plist);
ReadParaList(plist);
}
bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag)
......
......@@ -142,11 +142,11 @@ class DLLEXPORT HWPFile
/**
* Reads nmemb short type array from HIODev
*/
int Read2b( void *ptr, size_t nmemb );
void Read2b( void *ptr, size_t nmemb );
/**
* Reads nmemb long type array from HIODev
*/
int Read4b( void *ptr, size_t nmemb );
void Read4b( void *ptr, size_t nmemb );
/**
* Reads some bytes from HIODev not regarding endian's way
* @param size Amount for reading
......@@ -163,7 +163,7 @@ class DLLEXPORT HWPFile
/**
* Sets if the stream is compressed
*/
bool SetCompressed( bool );
void SetCompressed( bool );
/**
* Sets current HIODev
*/
......@@ -176,19 +176,19 @@ class DLLEXPORT HWPFile
/**
* Reads document information of hwp file from HIODev
*/
bool InfoRead(void);
void InfoRead(void);
/**
* Reads font list of hwp file from HIODev
*/
bool FontRead(void);
void FontRead(void);
/**
* Reads style list of hwp file from HIODev
*/
bool StyleRead(void);
void StyleRead(void);
/**
* Reads paragraph list of hwp file from HIODev
*/
bool ParaListRead();
void ParaListRead();
/* 그림 등의 추가 정보를 읽는다. */
/**
* Reads additional information like embedded image of hwp file from HIODev
......
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