From 097225a9ce5fbffccfbdbc0b47ba5a6fe5b4b818 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 9 Jun 2011 23:06:51 +0200 Subject: Some cppcheck cleaning --- hwpfilter/source/hbox.cpp | 5 ++--- hwpfilter/source/hcode.cpp | 8 ++++---- hwpfilter/source/hpara.cpp | 4 +--- hwpfilter/source/hwpeq.cpp | 8 +++++--- hwpfilter/source/hwpreader.cxx | 6 +++--- 5 files changed, 15 insertions(+), 16 deletions(-) (limited to 'hwpfilter/source') diff --git a/hwpfilter/source/hbox.cpp b/hwpfilter/source/hbox.cpp index 485bf3fb512d..fcdd706a3fdb 100644 --- a/hwpfilter/source/hbox.cpp +++ b/hwpfilter/source/hbox.cpp @@ -444,7 +444,6 @@ static hchar olHanglJaso(int num, int type) static unsigned char jung2[] = { 3, 7, 13, 20, 27, 29, 30 }; hchar hh = 0; - int j; if (type == OL_HANGL_JASO) { @@ -461,7 +460,7 @@ static hchar olHanglJaso(int num, int type) hh = (han_init[num] << 8) | 'a'; else { - j = (num / 14) % (sizeof(jung2) / sizeof(char)); + int j = (num / 14) % (sizeof(jung2) / sizeof(char)); num = num % 14; hh = (han_init[num] << 8) | (jung2[j] << 5) | 1; @@ -571,13 +570,13 @@ enum */ hchar *Outline::GetUnicode(hchar * hstr, int) { - int levelnum; hchar *p; hchar buffer[255]; buffer[0] = 0; if (kind == OUTLINE_NUM) { + int levelnum; switch (shape) { case OLSTY_NUMS1: diff --git a/hwpfilter/source/hcode.cpp b/hwpfilter/source/hcode.cpp index 728d9e077ccb..65ab7d662b5c 100644 --- a/hwpfilter/source/hcode.cpp +++ b/hwpfilter/source/hcode.cpp @@ -914,9 +914,7 @@ static JamoComp jamocomp1_to_unicode[] = //#define IS_OLD_HAN(x) (((x) >= 0x8020 && (x) <= 0x83ff ) || ( (x) >= 0x8420 && (x) <= 0x843f )) // beside these, there are very much characters in the hangul. int hcharconv(hchar ch, hchar *dest, int codeType) { - unsigned int index; - unsigned char lo, hi; - int res; + unsigned char lo; //printf("hcharconv[%04x]\n",ch); if (ch < 128){ dest[0] = ch; @@ -932,7 +930,7 @@ int hcharconv(hchar ch, hchar *dest, int codeType) dest[0] = 0xd55c; return 1 ; } - res = kssm_hangul_to_ucs2(ch, dest); + int res = kssm_hangul_to_ucs2(ch, dest); //printf("hcharconv Hangul[%04x]\n",dest[0]); return res; } @@ -942,6 +940,8 @@ int hcharconv(hchar ch, hchar *dest, int codeType) /* ڴ 0x4000 4888 . */ else if (IsHanja(ch)) { + unsigned int index; + unsigned char hi; /* 4888̿ Ʒѱۿ Ȯ̴. ̰Ϳ ؼ ڵ峪 ϼڵ ȯ ̺ ̴. */ diff --git a/hwpfilter/source/hpara.cpp b/hwpfilter/source/hpara.cpp index 1c0c95170de9..f781a311223d 100644 --- a/hwpfilter/source/hpara.cpp +++ b/hwpfilter/source/hpara.cpp @@ -72,8 +72,6 @@ HWPPara::HWPPara(void) HWPPara::~HWPPara(void) { - int ii; - if (linfo) delete[]linfo; if (cshapep) @@ -82,7 +80,7 @@ HWPPara::~HWPPara(void) { // virtual destructor /* C++은 null에 대해서도 동작한다. */ - for (ii = 0; ii < nch; ++ii) + for (int ii = 0; ii < nch; ++ii) delete hhstr[ii]; delete[]hhstr; diff --git a/hwpfilter/source/hwpeq.cpp b/hwpfilter/source/hwpeq.cpp index b6bee869b44e..0808d5100b55 100644 --- a/hwpfilter/source/hwpeq.cpp +++ b/hwpfilter/source/hwpeq.cpp @@ -540,7 +540,7 @@ static int next_token(MzString &white, MzString &token, istream *strm) static int read_white_space(MzString& outs, istream *strm) { - int ch, result; + int result; if( stk->state(strm) ) { outs << stk->white; @@ -548,6 +548,7 @@ static int read_white_space(MzString& outs, istream *strm) result = stk->token[0]; } else { + int ch; while( IS_WS(ch = strm->get()) ) outs << (char )ch; strm->putback(sal::static_int_cast(ch)); @@ -573,7 +574,7 @@ static int read_white_space(MzString& outs, istream *strm) static int eq_word(MzString& outs, istream *strm, int status) { MzString token, white, state; - int ch, result, nargs; + int result; char keyword[256]; hwpeq *eq; @@ -610,7 +611,8 @@ static int eq_word(MzString& outs, istream *strm, int status) script_status = SCRIPT_NONE; if( 0 != (eq = lookup_eqn(keyword)) ) { - nargs = eq->nargs; + int nargs = eq->nargs; + int ch; while( nargs-- ) { ch = read_white_space(state, strm); if( ch != '{' ) state << '{'; diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 2966019790bd..3ffc6a5c679e 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -1531,7 +1531,6 @@ void HwpReader::parseParaShape(ParaShape * pshape) */ void HwpReader::makePStyle(ParaShape * pshape) { - unsigned char tf = 0; int nscount = pshape->tabs[MAXTABS -1].type; padd(ascii("style:name"), sXML_CDATA, ascii(Int2Str(pshape->index, "P%d", buf))); @@ -1545,6 +1544,7 @@ void HwpReader::makePStyle(ParaShape * pshape) if( nscount ) { + unsigned char tf = 0; rstartEl(ascii("style:tab-stops"),rList); int tab_margin = pshape->left_margin + pshape->indent; @@ -3658,11 +3658,11 @@ void HwpReader::makeTextBox(TxtBox * hbox) ascii(Int2Str(hbox->style.boxnum, "Txtbox%d", buf))); padd(ascii("draw:name"), sXML_CDATA, ascii(Int2Str(hbox->style.boxnum, "Frame%d", buf))); - int x = 0; - int y = 0; if( hbox->style.cap_len <= 0 || hbox->type != TXT_TYPE ) { + int x = 0; + int y = 0; switch (hbox->style.anchor_type) { case CHAR_ANCHOR: -- cgit