incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1363749 - in /incubator/ooo/branches/AOO34: ./ main/ main/comphelper/ main/comphelper/inc/comphelper/ main/hwpfilter/source/
Date Fri, 20 Jul 2012 12:24:23 GMT
Author: alg
Date: Fri Jul 20 12:24:22 2012
New Revision: 1363749

URL: http://svn.apache.org/viewvc?rev=1363749&view=rev
Log:
warnings fixed for hwpfilter using newarray from comphelper

Added:
    incubator/ooo/branches/AOO34/main/comphelper/inc/comphelper/newarray.hxx
      - copied unchanged from r1362850, incubator/ooo/trunk/main/comphelper/inc/comphelper/newarray.hxx
Removed:
    incubator/ooo/branches/AOO34/main/hwpfilter/source/himgutil.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/himgutil.h
Modified:
    incubator/ooo/branches/AOO34/   (props changed)
    incubator/ooo/branches/AOO34/main/   (props changed)
    incubator/ooo/branches/AOO34/main/comphelper/Package_inc.mk
    incubator/ooo/branches/AOO34/main/hwpfilter/source/drawdef.h
    incubator/ooo/branches/AOO34/main/hwpfilter/source/drawing.h
    incubator/ooo/branches/AOO34/main/hwpfilter/source/formula.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.h
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.h
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hpara.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hstyle.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/htags.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpeq.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hwplib.h
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpread.cpp
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.cxx
    incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.hxx
    incubator/ooo/branches/AOO34/main/hwpfilter/source/makefile.mk
    incubator/ooo/branches/AOO34/main/hwpfilter/source/mapping.h

Propchange: incubator/ooo/branches/AOO34/
------------------------------------------------------------------------------
  Merged /incubator/ooo/trunk:r1362847,1362850,1362893,1363325

Propchange: incubator/ooo/branches/AOO34/main/
------------------------------------------------------------------------------
  Merged /incubator/ooo/trunk/main:r1362847,1362850,1362893,1363325

Modified: incubator/ooo/branches/AOO34/main/comphelper/Package_inc.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/comphelper/Package_inc.mk?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/comphelper/Package_inc.mk (original)
+++ incubator/ooo/branches/AOO34/main/comphelper/Package_inc.mk Fri Jul 20 12:24:22 2012
@@ -131,3 +131,4 @@ $(eval $(call gb_Package_add_file,comphe
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/processfactory.hxx,comphelper/processfactory.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/sequenceashashmap.hxx,comphelper/sequenceashashmap.hxx))
 $(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/configurationhelper.hxx,comphelper/configurationhelper.hxx))
+$(eval $(call gb_Package_add_file,comphelper_inc,inc/comphelper/newarray.hxx,comphelper/newarray.hxx))

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/drawdef.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/drawdef.h?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/drawdef.h (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/drawdef.h Fri Jul 20 12:24:22 2012
@@ -175,7 +175,7 @@ struct HWPDOProperty
 
     ZZPoint offset1;
     ZZPoint offset2;
-    char szPatternFile[MAX_PATH + 1];
+    char szPatternFile[260 + 1];
     char pictype;
 };
 

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/drawing.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/drawing.h?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/drawing.h (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/drawing.h Fri Jul 20 12:24:22 2012
@@ -36,6 +36,8 @@
 
 #include <math.h>
 
+#include <comphelper/newarray.hxx>
+
 #include "hwplib.h"
 #include "hwpfile.h"
 #include "hiodev.h"
@@ -361,6 +363,7 @@ static HWPDrawingObject *LoadDrawingObje
             hdo->child = LoadDrawingObject();
             if (hdo->child == NULL)
             {
+                goto error;
             }
         }
         if (prev == NULL)
@@ -659,6 +662,7 @@ static int getBlend(int alpha)
 }
 */
 
+
 static int
 HWPDOFreeFormFunc(int type, HWPDrawingObject * hdo,
 int cmd, void *argp, int argv)
@@ -682,7 +686,8 @@ int cmd, void *argp, int argv)
                 return OBJRET_FILE_ERROR;
             if (hdo->u.freeform.npt)
             {
-                hdo->u.freeform.pt = new ZZPoint[hdo->u.freeform.npt];
+                hdo->u.freeform.pt =
+                    ::comphelper::newArray_null<ZZPoint>(hdo->u.freeform.npt);
                 if (hdo->u.freeform.pt == NULL)
                 {
                     hdo->u.freeform.npt = 0;

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/formula.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/formula.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/formula.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/formula.cpp Fri Jul 20 12:24:22 2012
@@ -35,7 +35,6 @@ extern LinkedList<Node> nodelist;
 
 #include "hcode.h"
 
-static hchar entity[32];
 #define ascii(x)  OUString::createFromAscii(x)
 #define rstartEl(x,y)   rDocumentHandler->startElement(x,y)
 #define rendEl(x)    rDocumentHandler->endElement(x)
@@ -44,7 +43,6 @@ static hchar entity[32];
 #define reucstr(x,y) rDocumentHandler->characters(OUString(x,y, RTL_TEXTENCODING_EUC_KR))
 #define padd(x,y,z)  pList->addAttribute(x,y,z)
 #else
-static char entity[32];
 static int indent = 0;
 #define inds indent++; for(int i = 0 ; i < indent ; i++) fprintf(stderr," ")
 #define inde for(int i = 0 ; i < indent ; i++) fprintf(stderr," "); indent--
@@ -225,11 +223,12 @@ void Formula::makeIdentifier(Node *res)
 	 case ID_IDENTIFIER :
 #ifdef DEBUG
 		  inds;
-		  fprintf(stderr,"<math:mi>%s</math:mi>\n",getMathMLEntity(tmp->value, entity));
+          fprintf(stderr,"<math:mi>%s</math:mi>\n",
+                  getMathMLEntity(tmp->value).c_str());
 		  indo;
 #else
 		  rstartEl(ascii("math:mi"), rList);
-		  runistr(getMathMLEntity(tmp->value, entity));
+          runistr(getMathMLEntity(tmp->value).c_str());
 		  rendEl(ascii("math:mi"));
 #endif
 		  break;
@@ -251,7 +250,7 @@ void Formula::makeIdentifier(Node *res)
 		  inds; fprintf(stderr,"<math:mo>%s</math:mo>\n",tmp->value); indo;
 #else
 		  rstartEl(ascii("math:mo"), rList);
-		  runistr(getMathMLEntity(tmp->value,entity));
+          runistr(getMathMLEntity(tmp->value).c_str());
 		  rendEl(ascii("math:mo"));
 #endif
 		  break;
@@ -407,11 +406,12 @@ void Formula::makeDecoration(Node *res)
 
 #ifdef DEBUG
 	 inds;
-	 fprintf(stderr,"<math:mo>%s</math:mo>\n", getMathMLEntity(tmp->value,entity));
+     fprintf(stderr,"<math:mo>%s</math:mo>\n",
+             getMathMLEntity(tmp->value).c_str());
 	 indo;
 #else
 	 rstartEl(ascii("math:mo"), rList);
-	 runistr(getMathMLEntity(tmp->value,entity));
+     runistr(getMathMLEntity(tmp->value).c_str());
 	 rendEl(ascii("math:mo"));
 #endif
 
@@ -532,11 +532,14 @@ void Formula::makeFence(Node *res)
 	 Node *tmp = res->child;
 #ifdef DEBUG
 	 inds;
-	 fprintf(stderr,"<math:mfenced open=\"%s\" close=\"%s\">\n",getMathMLEntity(tmp->value, entity),
-				getMathMLEntity(tmp->next->next->value,entity));
-#else
-	 padd(ascii("open"), ascii("CDATA"), OUString(getMathMLEntity(tmp->value,entity)) );
-	 padd(ascii("close"), ascii("CDATA"), OUString(getMathMLEntity(tmp->next->next->value,entity)) );
+     fprintf(stderr,"<math:mfenced open=\"%s\" close=\"%s\">\n",
+                getMathMLEntity(tmp->value).c_str(),
+                getMathMLEntity(tmp->next->next->value).c_str());
+#else
+     padd(ascii("open"), ascii("CDATA"),
+             OUString(getMathMLEntity(tmp->value).c_str()) );
+     padd(ascii("close"), ascii("CDATA"),
+             OUString(getMathMLEntity(tmp->next->next->value).c_str()) );
 	 rstartEl(ascii("math:mfenced"), rList);
 	 pList->clear();
 #endif

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.cpp Fri Jul 20 12:24:22 2012
@@ -65,11 +65,11 @@ int HBox::WSize(void)
 }
 
 
-int HBox::GetString(hchar * hstr, int )
+hchar_string HBox::GetString()
 {
-    *hstr++ = hh;
-    *hstr = 0;
-    return 1;
+    hchar_string ret;
+    ret.push_back(hh);
+    return ret;
 }
 
 
@@ -145,9 +145,10 @@ DateCode::DateCode(void):HBox(CH_DATE_CO
 #define _DATECODE_WEEK_DEFINES_
 #include "datecode.h"
 
-int DateCode::GetString(hchar * hstr, int slen)
+hchar_string DateCode::GetString()
 {
-    hchar *fmt, *d;
+    hchar_string ret;
+    hchar *fmt;
     int i, num;
     const char *form;
     char cbuf[256];
@@ -157,8 +158,7 @@ int DateCode::GetString(hchar * hstr, in
     format[DATE_SIZE - 1] = 0;
     fmt = format[0] ? format : defaultform;
 
-    d = hstr;
-    for (; *fmt && ((int) (d - hstr) < DATE_SIZE) && slen > 1; fmt++)
+    for (; *fmt && ((int) ret.size() < DATE_SIZE); fmt++)
     {
         form = (add_zero) ? "%02d" : "%d";
 
@@ -222,8 +222,7 @@ int DateCode::GetString(hchar * hstr, in
                 num = date[MIN];
                 break;
             case '6':
-                *d++ = kor_week[date[WEEK]];
-                slen--;
+                ret.push_back(kor_week[date[WEEK]]);
                 break;
             case '^':
                 memcpy(cbuf, eng_week + date[WEEK] * 3, 3);
@@ -234,11 +233,8 @@ int DateCode::GetString(hchar * hstr, in
                 strcpy(cbuf, en_week[date[WEEK]]);
                 break;
             case '7':
-                if (slen > 3)
-                {
-                    *d++ = 0xB5A1;
-                    *d++ = (is_pm) ? 0xD281 : 0xB8E5;
-                }
+                ret.push_back(0xB5A1);
+                ret.push_back((is_pm) ? 0xD281 : 0xB8E5);
                 break;
             case '&':
                 strcpy(cbuf, (is_pm) ? "p.m." : "a.m.");
@@ -271,28 +267,24 @@ int DateCode::GetString(hchar * hstr, in
                 fmt++;
                 if (*fmt == '6')
                 {
-                    *d++ = china_week[date[WEEK]];
-                    slen--;
+                    ret.push_back(china_week[date[WEEK]]);
                     break;
                 }
                 break;
             default:
                 if (*fmt == '\\' && *++fmt == 0)
                     goto done;
-                *d++ = *fmt;
-                slen--;
+                ret.push_back(*fmt);
         }
         if (num != -1)
             sprintf(cbuf, form, num);
-        for (i = 0; 0 != cbuf[i] && slen > 1; i++)
+        for (i = 0; 0 != cbuf[i]; i++)
         {
-            *d++ = *(cbuf + i);
-            slen--;
+            ret.push_back(*(cbuf + i));
         }
     }
     done:
-    *d = 0;
-    return hstrlen(hstr);
+    return ret;
 }
 
 
@@ -415,10 +407,9 @@ Footnote::~Footnote(void)
 // Ȧ¼öÂʽÃÀÛ/°¨Ãß±â (21)
 
 // mail merge(22)
-int MailMerge::GetString(hchar * hstr, int )
+hchar_string MailMerge::GetString()
 {
-    *hstr = 0;
-    return 0;
+    return hchar_string();
 }
 
 
@@ -564,7 +555,7 @@ enum
     number´Â °ªÀÌ ±×´ë·Î µé¾î°¡ ÀÖ´Ù. Áï, 1.2.1¿¡´Â 1,2,1ÀÌ µé¾î°¡ ÀÖ´Ù.
     style Àº 1ºÎÅÍ °ªÀÌ µé¾î°¡ ÀÖ´Ù. hbox.h¿¡ Á¤ÀÇµÈ µ¥·Î..
  */
-hchar *Outline::GetUnicode(hchar * hstr, int)
+hchar_string Outline::GetUnicode() const
 {
     int levelnum;
     hchar *p;
@@ -592,14 +583,14 @@ hchar *Outline::GetUnicode(hchar * hstr,
                     strcat(buf, cur_num_str);
                 }
                 str2hstr(buf, buffer);
-					 return hstr2ucsstr(buffer, hstr);
+					 return hstr2ucsstr(buffer);
             }
             case OLSTY_NUMSIG1:
             case OLSTY_NUMSIG2:
             case OLSTY_NUMSIG3:
 				{
                 getOutlineNumStr(shape, level, number[level], buffer);
-					 return hstr2ucsstr(buffer, hstr);
+                     return hstr2ucsstr(buffer);
 				}
             case OLSTY_BULLET1:
             case OLSTY_BULLET2:
@@ -610,7 +601,7 @@ hchar *Outline::GetUnicode(hchar * hstr,
                 p = GetOutlineStyleChars(shape);
                 buffer[0] = p[level];
                 buffer[1] = 0;
-					 return hstr2ucsstr(buffer, hstr);
+                     return hstr2ucsstr(buffer);
 				}
             case OLSTY_USER:
             case OLSTY_BULUSER:
@@ -697,11 +688,11 @@ hchar *Outline::GetUnicode(hchar * hstr,
 						buffer[l++] = deco[i][1];
 					}
 					buffer[l] = 0;
-					return hstr2ucsstr(buffer, hstr);
+                    return hstr2ucsstr(buffer);
 				}
         }
     }
-	 return hstr2ucsstr(buffer, hstr);
+    return hstr2ucsstr(buffer);
 }
 
 

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.h?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.h (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hbox.h Fri Jul 20 12:24:22 2012
@@ -66,12 +66,8 @@ struct HBox
  * @returns True if reading from stream is successful.
  */
         virtual int   Read(HWPFile &hwpf);
-/**
- * @param hstr Buffer to save string
- * @param slen Size of buffer
- * @returns The string having each proper format by pointer
- */
-        virtual int   GetString(hchar *hstr, int slen = 255);
+
+        virtual hchar_string GetString();
     private:
         static int boxCount;
 };
@@ -168,10 +164,8 @@ struct DateCode: public HBox
 
     DateCode();
     virtual int Read(HWPFile &hwpf);
-/**
- * @returns Length of date string
- */
-    virtual int GetString(hchar *hstr, int slen = 255);
+
+    virtual hchar_string GetString();
 };
 
 /**
@@ -409,8 +403,8 @@ struct TxtBox: public FBox
 struct Columns
 {
 	 int *data;
-	 int nCount;
-	 int nTotal;
+     size_t nCount;
+     size_t nTotal;
 	 Columns(){
 		  nCount = 0;
 		  nTotal = INIT_SIZE;
@@ -420,8 +414,12 @@ struct Columns
 
 	 void AddColumnsSize(){
 		  int *tmp = data;
+          if (nTotal + ADD_AMOUNT < nTotal) // overflow
+          {
+              throw ::std::bad_alloc();
+          }
 		  data = new int[nTotal + ADD_AMOUNT];
-		  for( int i = 0 ; i < nTotal ; i++ )
+          for (size_t i = 0 ; i < nTotal ; i++)
 				data[i] = tmp[i];
 		  nTotal += ADD_AMOUNT;
 		  delete[] tmp;
@@ -432,13 +430,13 @@ struct Columns
 				data[nCount++] = pos;
 				return;
 		  }
-		  for( int i = 0 ; i < nCount; i++ ){
+          for (size_t i = 0 ; i < nCount; i++ ) {
 				if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
 					 return;  // Already exist;
 				if( pos < data[i] ){
 					 if( nCount == nTotal )
 						  AddColumnsSize();
-					 for( int j = nCount ; j > i ; j-- )
+                     for (size_t j = nCount ; j > i ; j--)
 						  data[j] = data[j-1];
 					 data[i] = pos;
 					 nCount++;
@@ -455,7 +453,7 @@ struct Columns
 	 {
 		  if( pos == 0 )
 				return 0;
-		  for( int i = 0 ; i < nCount; i++){
+          for (size_t i = 0 ; i < nCount; i++) {
 				if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
 					 return i;
 		  }
@@ -466,8 +464,8 @@ struct Columns
 struct Rows
 {
 	 int *data;
-	 int nCount;
-	 int nTotal;
+     size_t nCount;
+     size_t nTotal;
 	 Rows(){
 		  nCount = 0;
 		  nTotal = INIT_SIZE;
@@ -477,8 +475,12 @@ struct Rows
 
 	 void AddRowsSize(){
 		  int *tmp = data;
+          if (nTotal + ADD_AMOUNT < nTotal) // overflow
+          {
+              throw ::std::bad_alloc();
+          }
 		  data = new int[nTotal + ADD_AMOUNT];
-		  for( int i = 0 ; i < nTotal ; i++ )
+          for (size_t i = 0 ; i < nTotal ; i++)
 				data[i] = tmp[i];
 		  nTotal += ADD_AMOUNT;
 		  delete[] tmp;
@@ -489,13 +491,13 @@ struct Rows
 				data[nCount++] = pos;
 				return;
 		  }
-		  for( int i = 0 ; i < nCount; i++ ){
+          for (size_t i = 0 ; i < nCount; i++) {
 				if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
 					 return;  // Already exist;
 				if( pos < data[i] ){
 					 if( nCount == nTotal )
 						  AddRowsSize();
-					 for( int j = nCount ; j > i ; j-- )
+                     for (size_t j = nCount ; j > i ; j--)
 						  data[j] = data[j-1];
 					 data[i] = pos;
 					 nCount++;
@@ -512,7 +514,7 @@ struct Rows
 	 {
 		  if( pos == 0 )
 				return 0;
-		  for( int i = 0 ; i < nCount; i++){
+          for (size_t i = 0 ; i < nCount; i++) {
 				if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
 					 return i;
 		  }
@@ -866,7 +868,7 @@ struct MailMerge: public HBox
     MailMerge();
 
     virtual int Read(HWPFile &hwpf);
-    virtual int GetString(hchar *, int slen = 255);
+    virtual hchar_string GetString();
 };
 
 // char compositon(23)
@@ -1004,7 +1006,7 @@ class Outline: public HBox
         Outline();
 
         virtual int   Read(HWPFile &hwpf);
-        hchar *GetUnicode(hchar *, int slen = 255);
+        hchar_string GetUnicode() const;
 };
 
 /* ¹­À½ ºóÄ­(30) */

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.cpp Fri Jul 20 12:24:22 2012
@@ -1198,49 +1198,46 @@ hchar ksc5601_han_to_ucs2 (hchar input)
     return '?';
 }
 
-hchar* hstr2ucsstr(hchar* hstr, hchar* ubuf)
+hchar_string hstr2ucsstr(hchar const* hstr)
 {
-  int i = 0, j;
-  int res;
-  hchar dest[3];
-  hchar *tmp = ubuf;
-  for( ; *hstr ; ){
-	  res = hcharconv(*hstr++, dest, UNICODE);
-	  for( j = 0 ; j < res ; j++)
-			tmp[i++] = dest[j];
-  }
-
-  tmp[i]= '\0';
-  return ubuf;
+    hchar_string ret;
+    hchar dest[3];
+    for( ; *hstr ; ){
+        int const res = hcharconv(*hstr++, dest, UNICODE);
+        for (int j = 0 ; j < res ; j++) {
+            ret.push_back(dest[j]);
+        }
+    }
+    return ret;
 }
+
 /**
  * ÇÑÄĽºÆ®¸µÀ» ¿Ï¼ºÇü½ºÆ®¸µÀ¸·Î º¯È¯ÇÑ´Ù
  */
-int hstr2ksstr(hchar* hstr, char* buf)
+::std::string hstr2ksstr(hchar const* hstr)
 {
-
-    int i = 0, res, j;
+    ::std::string ret;
+    int res, j;
     int c;
 	 hchar dest[3];
-    char *tmp = buf;
     for( ; *hstr ; )
     {
         res = hcharconv(*hstr++, dest, KS);
 		  for( j = 0 ; j < res ; j++ ){
 			  c = dest[j];
 			  if( c < 32 ) c = ' ';
-              else if( c < 256 ) 
-                    tmp[i++] = sal::static_int_cast<char>(c);
+              else if( c < 256 )
+              {
+                  ret.push_back(sal::static_int_cast<char>(c));
+              }
 			  else
 			  {
-                    tmp[i++] = sal::static_int_cast<char>((c >> 8 ) & 0xff);
-                    tmp[i++] = sal::static_int_cast<char>(c & 0xff);
+                  ret.push_back(sal::static_int_cast<char>((c >> 8 ) & 0xff));
+                  ret.push_back(sal::static_int_cast<char>(c & 0xff));
 			  }
 		  }
     }
-    tmp[i]= '\0';
-
-    return i;
+    return ret;
 }
 
 
@@ -1248,25 +1245,22 @@ int hstr2ksstr(hchar* hstr, char* buf)
  * Çѱۿ¡¼­ ¿µ¹®¿ÜÀÇ ¹®ÀÚ±îÁö Æ÷ÇÔÇÒ ¼ö ÀÖ´Â kcharŸÀÔÀÇ ¹®ÀÚ¿­À»
  * Çѱۿ¡¼­ »ç¿ëÇÏ´Â hcharŸÀÔÀÇ ¹®ÀÚ¿­·Î º¯È¯ÇÑ´Ù.
  */
-unsigned short *kstr2hstr( unsigned char *src, unsigned short *dest )
+hchar_string kstr2hstr(unsigned char const* src)
 {
-    int i=0, ii;
-    unsigned short* tmp = dest;
-
-    for(i=0,ii=0 ; src[i] != '\0' ; i++,ii++ )
+    hchar_string ret;
+    for (unsigned int i = 0; src[i] != '\0' ; i++)
     {
         if ( src[i] < 127 )
         {
-            tmp[ii] = src[i];
+            ret.push_back(src[i]);
         }
         else
         {
-            tmp[ii] = src[i] << 8 | src[i+1];
+            ret.push_back(src[i] << 8 | src[i+1]);
             i++;
         }
     }
-    tmp[ii] = '\0';
-    return dest;
+    return ret;
 }
 
 
@@ -1338,119 +1332,87 @@ char *hcolor2str(uchar color, uchar shad
 }
 
 
-char *urltounix(const char *src, char *dest )
+::std::string urltounix(const char *src)
 {
+    ::std::string ret;
+    unsigned int i = 0;
     if( src[0] == 'C' && src[1] == ':' && src[2] == '\\' ) // Home Dir
     {
-        unsigned int i, len;
-        sprintf(dest,"file://%s/", getenv("HOME") );
-        len = strlen( dest );
-
-        for( i = 0 ; i + 3 < strlen(src) ; i++ )
-        {
-            if( src[i + 3] == '\\')
-                dest[i + len] = '/';
-            else
-                dest[i + len] = src[ i +3];
-        }
-        dest[i + len] = '\0';
-        return dest;
+        ret.append("file://");
+        ret.append(getenv("HOME"));
+        ret.push_back('/');
+        i = 3; // skip first 3
     }
     else if( src[0] == 'D' && src[1] == ':' && src[2] == '\\' ) // Root Dir
     {
-        unsigned int i, len;
-        sprintf(dest,"file:///");
-        len = strlen( dest );
-        for( i = 0 ; i + 3 < strlen(src) ; i++ )
-        {
-            if( src[i + 3] == '\\')
-                dest[i + len] = '/';
-            else
-                dest[i + len] = src[i+3];
-        }
-        dest[i + len] = '\0';
-        return dest;
+        ret.append("file:///");
+        i = 3; // skip first 3
     }
     else if( !strncmp(src,"http",4)  ) // Start from "http"
-	 {
-        unsigned int i;
-        for( i = 0 ; i < strlen(src) ; i++ )
-        {
-            if( src[i] == '\\')
-                dest[i] = '/';
-            else
-                dest[i] = src[i];
-        }
-        dest[i] = '\0';
-        return dest;
+    {
+        // nothing special here, just copy
     }
 	 else
     {
-        unsigned int i, len, srclen;
-		  srclen = strlen(src);
-		  char ext[4];
-		  strncpy(ext,src + srclen - 3,3);
-		  ext[3]=0;
+        unsigned int srclen = strlen(src);
+        if (3 < srclen)
+        {
+            char const*const ext = src + (srclen-3);
 #ifdef _WIN32
-          if( _strnicmp(ext,"HWP",3) && _strnicmp(ext,"HWT",3))
+            if (_strnicmp(ext,"HWP",3) && _strnicmp(ext,"HWT",3))
 #else
-          if( strcasecmp(ext,"HWP") && strcasecmp(ext,"HWT"))
+            if (strcasecmp(ext,"HWP") && strcasecmp(ext,"HWT"))
 #endif
-              sprintf(dest, "http://");
-		  len = strlen(dest);
-        for( i = 0 ; i < strlen(src) ; i++ )
-        {
-            if( src[i] == '\\')
-                dest[i+len] = '/';
-            else
-                dest[i+len] = src[i];
+            {
+                ret.append("http://");
+            }
         }
-        dest[i+len] = '\0';
-        return dest;
 	 }
+     for (; i < strlen(src); i++)
+     {
+        if (src[i] == '\\') {
+            ret.push_back('/');
+        } else {
+            ret.push_back(src[i]);
+        }
+     }
+     return ret;
 }
 
 #ifdef _WIN32
-char *urltowin(const char *src, char *dest )
+::std::string urltowin(const char *src)
 {
+    std::string ret;
     if( !_strnicmp(src, "http", 4))
 	 {
-        int i;
-        for( i = 0 ; i < sal::static_int_cast<int>(strlen(src)) ; i++ )
-        {
-            if( src[i] == '\\')
-                dest[i] = '/';
-            else
-                dest[i] = src[i];
-        }
-        dest[i] = '\0';
-        return dest;
+        // nothing special here, just copy
     }
 	 else
     {
-        int i, len, srclen;
-		  srclen = strlen(src);
-		  char ext[4];
-		  strncpy(ext,src + srclen - 3,3);
-		  ext[3]=0;
-		  //printf("hcode.cpp : ext = %s\n",ext);
-
-		  if( !_strnicmp(ext,"HWP",3) || !_strnicmp(ext,"HWT",3)){
-				strcpy(dest,src);
-				return dest;
-		  }
-		  sprintf(dest, "http://");
-		  len = strlen(dest);
-        for( i = 0 ; i < sal::static_int_cast<int>(strlen(src)) ; i++ )
+        unsigned int srclen = strlen(src);
+        if (3 < srclen)
         {
-            if( src[i] == '\\')
-                dest[i+len] = '/';
+            char const*const ext = src + (srclen-3);
+            if (_strnicmp(ext,"HWP",3) && _strnicmp(ext,"HWT",3))
+            {
+                ret.append("http://");
+            }
             else
-                dest[i+len] = src[i];
+            {
+                ret.append(src); // no backslash conversion
+                return ret;
+            }
         }
-        dest[i+len] = '\0';
-        return dest;
 	 }
+    for (unsigned int i = 0; i < strlen(src); i++)
+    {
+        if (src[i] == '\\') {
+            ret.push_back('/');
+        } else {
+            ret.push_back(src[i]);
+        }
+    }
+    return ret;
 }
 #endif
 

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.h?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.h (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hcode.h Fri Jul 20 12:24:22 2012
@@ -41,27 +41,27 @@ DLLEXPORT int hcharconv(hchar ch, hchar 
 DLLEXPORT int   kssm_hangul_to_ucs2(hchar ch, hchar *dest) ;
 DLLEXPORT hchar ksc5601_han_to_ucs2 (hchar);
 DLLEXPORT hchar ksc5601_sym_to_ucs2 (hchar);
-DLLEXPORT hchar* hstr2ucsstr(hchar* hstr, hchar* ubuf);
+DLLEXPORT hchar_string hstr2ucsstr(hchar const* hstr);
 /**
  * ÇÑÄĽºÆ®¸µÀ» ¿Ï¼ºÇü½ºÆ®¸µÀ¸·Î º¯È¯ÇÑ´Ù.
  */
-DLLEXPORT int hstr2ksstr(hchar* hstr, char* buf);
+DLLEXPORT ::std::string hstr2ksstr(hchar const* hstr);
 
 /**
  * ÇѱÛÀ» Æ÷ÇÔÇÒ ¼ö ÀÖ´Â charÇü½ºÆ®¸µÀ» ÇÑÄĽºÆ®¸µÀ¸·Î º¯È¯ÇÑ´Ù.
  */
-DLLEXPORT hchar *kstr2hstr( uchar *src, hchar *dest );
+DLLEXPORT hchar_string kstr2hstr(uchar const* src);
 
 /**
  * hwpÀÇ °æ·Î¸¦ unixÇüÅ·Π¹Ù²Û´Ù.
  */
-DLLEXPORT char *urltounix(const char *src, char *buf );
+DLLEXPORT ::std::string urltounix(const char *src);
 
 /**
  * hwpÀÇ °æ·Î¸¦ windowsÇüÅ·Π¹Ù²Û´Ù.
  */
 #ifdef _WIN32
-DLLEXPORT char *urltowin(const char *src, char *buf );
+DLLEXPORT ::std::string urltowin(const char *src);
 #endif
 /**
  *  Transfer interger to string following format

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hpara.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hpara.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hpara.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hpara.cpp Fri Jul 20 12:24:22 2012
@@ -22,9 +22,11 @@
 
 
 /* $Id: hpara.cpp,v 1.6 2008-06-04 09:59:35 vg Exp $ */
-
+#define NOMINMAX
 #include "precompile.h"
 
+#include <comphelper/newarray.hxx>
+
 #include "hwplib.h"
 #include "hwpfile.h"
 #include "hpara.h"
@@ -116,7 +118,8 @@ int HWPPara::Read(HWPFile & hwpf, unsign
 		  pshape.pagebreak = etcflag;
     }
 
-    linfo = new LineInfo[nline];
+    linfo = ::comphelper::newArray_null<LineInfo>(nline);
+    if (!linfo) { return false; }
     for (ii = 0; ii < nline; ii++)
     {
         linfo[ii].Read(hwpf, this);
@@ -143,7 +146,7 @@ int HWPPara::Read(HWPFile & hwpf, unsign
 
     if (contain_cshape)
     {
-        cshapep = new CharShape[nch];
+        cshapep = ::comphelper::newArray_null<CharShape>(nch);
         if (!cshapep)
         {
             perror("Memory Allocation: cshape\n");
@@ -167,7 +170,8 @@ int HWPPara::Read(HWPFile & hwpf, unsign
         }
     }
 // read string
-    hhstr = new HBox *[nch];
+    hhstr = ::comphelper::newArray_null<HBox *>(nch);
+    if (!hhstr) { return false; }
     for (ii = 0; ii < nch; ii++)
         hhstr[ii] = 0;
     ii = 0;

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hstyle.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hstyle.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hstyle.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hstyle.cpp Fri Jul 20 12:24:22 2012
@@ -23,8 +23,11 @@
 
 /* $Id: hstyle.cpp,v 1.3 2008-04-10 12:07:14 rt Exp $ */
 
+#define NOMINMAX
 #include "precompile.h"
 
+#include <comphelper/newarray.hxx>
+
 #include    "hwplib.h"
 #include    "hwpfile.h"
 #include    "hstyle.h"
@@ -129,7 +132,7 @@ bool HWPStyle::Read(HWPFile & hwpf)
     ParaShape pshape;
 
     hwpf.Read2b(&nstyles, 1);
-    style = new StyleData[nstyles];
+    style = ::comphelper::newArray_null<StyleData>(nstyles);
     if (!style)
         return false;
 

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/htags.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/htags.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/htags.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/htags.cpp Fri Jul 20 12:24:22 2012
@@ -41,7 +41,6 @@
 #include "hwplib.h"
 #include "hwpfile.h"
 #include "htags.h"
-#include "himgutil.h"
 
 bool HyperText::Read(HWPFile & hwpf)
 {
@@ -75,11 +74,6 @@ EmPicture::EmPicture(int tsize):size(tsi
 #endif
 EmPicture::~EmPicture(void)
 {
-// clear temporary image file
-    char *fname = (char *) GetEmbImgname(this);
-
-    if (fname && access(fname, 0) == 0)
-        unlink(fname);
     if (data)
         delete[]data;
 };

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpeq.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpeq.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpeq.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpeq.cpp Fri Jul 20 12:24:22 2012
@@ -678,7 +678,7 @@ static bool eq_sentence(MzString& outs, 
 static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
 {
   MzString	white, token;
-  char		key[20];
+  char		key[256];
   int		ch, result;
   hwpeq		*eq = 0;
 

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hwplib.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hwplib.h?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hwplib.h (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hwplib.h Fri Jul 20 12:24:22 2012
@@ -26,6 +26,9 @@
 #ifndef _HWPLIB_H_
 #define _HWPLIB_H_
 #include "precompile.h"
+
+#include <string>
+
 /* hwp96ºÎÅÍ hunit°¡ 4byte°¡ µÇ¾ú´Ù. */
 /**
  * size of hunit is 4 since hwp96 version
@@ -56,6 +59,8 @@ typedef unsigned int    uint;
 typedef unsigned long   ulong;
 #endif                                            /* _UTYPE_ */
 
+typedef ::std::basic_string<hchar> hchar_string;
+
 #ifndef _ZZRECT_
 #define _ZZRECT_
 /**

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpread.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpread.cpp?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpread.cpp (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpread.cpp Fri Jul 20 12:24:22 2012
@@ -23,8 +23,11 @@
 
 /* $Id: hwpread.cpp,v 1.5 2008-04-10 12:10:14 rt Exp $ */
 
+#define NOMINMAX
 #include "precompile.h"
 
+#include <comphelper/newarray.hxx>
+
 #include "list.hxx"
 
 #include "hwpfile.h"
@@ -83,20 +86,30 @@ int FieldCode::Read(HWPFile & hwpf)
     hwpf.Read4b(&len3, 1);
     hwpf.Read4b(&binlen, 1);
 
-    str1 = new hchar[len1];
-    str2 = new hchar[len2];
-    str3 = new hchar[len3];
+    ulong const len1_ = ((len1 > 1024) ? 1024 : len1) / sizeof(hchar);
+    ulong const len2_ = ((len2 > 1024) ? 1024 : len2) / sizeof(hchar);
+    ulong const len3_ = ((len3 > 1024) ? 1024 : len3) / sizeof(hchar);
+
+    str1 = new hchar[len1_ ? len1_ : 1];
+    str2 = new hchar[len2_ ? len2_ : 1];
+    str3 = new hchar[len3_ ? len3_ : 1];
     bin = new char[binlen];
 
-    hwpf.Read2b(str1, len1/2);
-    hwpf.Read2b(str2, len2/2);
-    hwpf.Read2b(str3, len3/2);
+    hwpf.Read2b(str1, len1_);
+    hwpf.SkipBlock(len1 - (len1_ * sizeof(hchar)));
+    str1[len1_ ? (len1_ - 1) : 0] = 0;
+    hwpf.Read2b(str2, len2_);
+    hwpf.SkipBlock(len2 - (len2_ * sizeof(hchar)));
+    str2[len2_ ? (len2_ - 1) : 0] = 0;
+    hwpf.Read2b(str3, len3_);
+    hwpf.SkipBlock(len3 - (len3_ * sizeof(hchar)));
+    str3[len3_ ? (len3_ - 1) : 0] = 0;
 
     hwpf.ReadBlock(bin, binlen);
 
      if( type[0] == 3 && type[1] == 2 ){ /* ¸¸µç³¯Â¥·Î¼­ Æ÷¸ËÀ» »ý¼ºÇØ¾ß ÇÑ´Ù. */
 		  DateCode *pDate = new DateCode;
-          for( int i = 0 ;i < (int)(len3/2) ; i++ ){
+          for (int i = 0 ; i < static_cast<int>(len3_); i++) {
 				if(str3[i] == 0 ) break;
 				if( i >= DATE_SIZE ) break;
 				pDate->format[i] = str3[i];
@@ -283,7 +296,10 @@ int TxtBox::Read(HWPFile & hwpf)
         return hwpf.SetState(HWP_InvalidFileFormat);
 	 }
 
-    cell = new Cell[ncell];
+    cell = ::comphelper::newArray_null<Cell>(ncell);
+    if (!cell) {
+        return hwpf.SetState(HWP_InvalidFileFormat);
+    }
     for (ii = 0; ii < ncell; ii++)
     {
         cell[ii].Read(hwpf);
@@ -291,7 +307,10 @@ int TxtBox::Read(HWPFile & hwpf)
     }
     if (ncell == 1)
         style.cell = &cell[0];
-    plists = new LinkedList < HWPPara >[ncell];
+    plists = ::comphelper::newArray_null< LinkedList< HWPPara > >(ncell);
+    if (!plists) {
+        return hwpf.SetState(HWP_InvalidFileFormat);
+    }
     for (ii = 0; ii < ncell; ii++)
         hwpf.ReadParaList(plists[ii]);
 	 // caption
@@ -306,7 +325,10 @@ int TxtBox::Read(HWPFile & hwpf)
 				tbl->rows.insert(cell[ii].y);
 				tbl->rows.insert(cell[ii].y + cell[ii].h);
 		  }
-		  TCell* *pArr = new TCell*[ncell];
+          TCell* *pArr = ::comphelper::newArray_null<TCell *>(ncell);
+          if (!pArr) {
+                return hwpf.SetState(HWP_InvalidFileFormat);
+          }
 		  for( ii = 0 ; ii < ncell; ii++)
 		  {
 				TCell *tcell = new TCell;

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.cxx?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.cxx (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.cxx Fri Jul 20 12:24:22 2012
@@ -23,9 +23,13 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_hwpfilter.hxx"
+#define NOMINMAX
 
 #include "hwpreader.hxx"
 #include <math.h>
+
+#include <comphelper/newarray.hxx>
+
 //#ifndef UDK100
 #include "formula.h"
 #include "cspline.h"
@@ -41,7 +45,7 @@ extern int getRepFamilyName(const char* 
 #endif
 
 // To be shorten source code by realking
-#define hconv(x,y) OUString(hstr2ucsstr(x,y))
+#define hconv(x)        OUString(hstr2ucsstr(x).c_str())
 #define ascii(x)        OUString::createFromAscii(x)
 #define rstartEl(x,y)   rDocumentHandler->startElement(x,y)
 #define rendEl(x)       rDocumentHandler->endElement(x)
@@ -74,8 +78,6 @@ extern int getRepFamilyName(const char* 
     rendEl(ascii("text:span")); \
     tstart = false
 
-static hchar gstr[1024];
-static hchar sbuf[256];
 static hchar *field = 0L;
 static char buf[1024];
 
@@ -281,21 +283,21 @@ void HwpReader::makeMeta()
     if (hwpinfo->summary.title[0])
     {
         rstartEl(ascii("dc:title"), rList);
-        rchars((hconv(hwpinfo->summary.title, gstr)));
+        rchars((hconv(hwpinfo->summary.title)));
         rendEl(ascii("dc:title"));
     }
 
     if (hwpinfo->summary.subject[0])
     {
         rstartEl(ascii("dc:subject"), rList);
-        rchars((hconv(hwpinfo->summary.subject, gstr)));
+        rchars((hconv(hwpinfo->summary.subject)));
         rendEl(ascii("dc:subject"));
     }
 
     if (hwpinfo->summary.author[0])
     {
         rstartEl(ascii("meta:initial-creator"), rList);
-        rchars((hconv(hwpinfo->summary.author, gstr)));
+        rchars((hconv(hwpinfo->summary.author)));
         rendEl(ascii("meta:initial-creator"));
     }
 
@@ -372,31 +374,31 @@ void HwpReader::makeMeta()
         if (hwpinfo->summary.keyword[0][0])
         {
             rstartEl(ascii("meta:keyword"), rList);
-            rchars((hconv(hwpinfo->summary.keyword[0], gstr)));
+            rchars((hconv(hwpinfo->summary.keyword[0])));
             rendEl(ascii("meta:keyword"));
         }
         if (hwpinfo->summary.keyword[1][0])
         {
             rstartEl(ascii("meta:keyword"), rList);
-            rchars((hconv(hwpinfo->summary.keyword[1], gstr)));
+            rchars((hconv(hwpinfo->summary.keyword[1])));
             rendEl(ascii("meta:keyword"));
         }
         if (hwpinfo->summary.etc[0][0])
         {
             rstartEl(ascii("meta:keyword"), rList);
-            rchars((hconv(hwpinfo->summary.etc[0], gstr)));
+            rchars((hconv(hwpinfo->summary.etc[0])));
             rendEl(ascii("meta:keyword"));
         }
         if (hwpinfo->summary.etc[1][0])
         {
             rstartEl(ascii("meta:keyword"), rList);
-            rchars((hconv(hwpinfo->summary.etc[1], gstr)));
+            rchars((hconv(hwpinfo->summary.etc[1])));
             rendEl(ascii("meta:keyword"));
         }
         if (hwpinfo->summary.etc[2][0])
         {
             rstartEl(ascii("meta:keyword"), rList);
-            rchars((hconv(hwpinfo->summary.etc[2], gstr)));
+            rchars((hconv(hwpinfo->summary.etc[2])));
             rendEl(ascii("meta:keyword"));
         }
         rendEl(ascii("meta:keywords"));
@@ -405,7 +407,7 @@ void HwpReader::makeMeta()
     padd(ascii("meta:name"), sXML_CDATA, ascii("BBSID"));
     rstartEl(ascii("meta:user-defined"), rList);
     pList->clear();
-    rchars((hconv(hwpinfo->summary.etc[2], gstr)));
+    rchars((hconv(hwpinfo->summary.etc[2])));
     rendEl(ascii("meta:user-defined"));
 
     rstartEl(ascii("dc:language"), rList);
@@ -554,7 +556,7 @@ void HwpReader::makeDrawMiscStyle( HWPDr
                 if( !prop->pictype )
                 {
                     padd( ascii("xlink:href"), sXML_CDATA,
-                        hconv(kstr2hstr( (uchar *)urltounix(prop->szPatternFile, buf), sbuf), gstr));
+                        hconv(kstr2hstr( (uchar *)urltounix(prop->szPatternFile).c_str()).c_str()));
                 }
                 else                              /* ???????? image???? ?????? ???????? ????. */
                 {
@@ -563,7 +565,7 @@ void HwpReader::makeDrawMiscStyle( HWPDr
                         emp = hwpfile.GetEmPictureByName(prop->szPatternFile);
                     if( emp )
                     {
-                        char filename[128];
+                        char filename[128+17+9];
                         char dirname[128];
                         int fd, res;
 #ifdef _WIN32
@@ -596,7 +598,7 @@ void HwpReader::makeDrawMiscStyle( HWPDr
                     else
                     {
                         padd( ascii("xlink:href"), sXML_CDATA,
-                            hconv(kstr2hstr( (uchar *)urltounix(prop->szPatternFile, buf), sbuf), gstr));
+                            hconv(kstr2hstr( (uchar *)urltounix(prop->szPatternFile).c_str()).c_str()));
                     }
 
                 }
@@ -777,7 +779,7 @@ void HwpReader::makeStyles()
     for (int ii = 0; ii < hwpstyle->Num(); ii++)
     {
         unsigned char *stylename = (unsigned char *) hwpstyle->GetName(ii);
-        padd(ascii("style:name"), sXML_CDATA, (hconv(kstr2hstr(stylename, sbuf), gstr)));
+        padd(ascii("style:name"), sXML_CDATA, (hconv(kstr2hstr(stylename).c_str())));
         padd(ascii("style:family"), sXML_CDATA, ascii("paragraph"));
         padd(ascii("style:parent-style-name"), sXML_CDATA, ascii("Standard"));
 
@@ -995,7 +997,7 @@ void HwpReader::makeMasterStyles()
 
     int i;
     int nMax = hwpfile.getMaxSettedPage();
-    PageSetting *pSet = new PageSetting[nMax + 1];
+    PageSetting *const pSet = ::comphelper::newArray_ex<PageSetting>(nMax + 1);
 
     for( i = 0 ; i < hwpfile.getPageNumberCount() ; i++ )
     {
@@ -1377,10 +1379,10 @@ void HwpReader::parseCharShape(CharShape
     padd(ascii("style:font-size-asian"), sXML_CDATA,
         ascii(Int2Str(cshape->size / 25, "%dpt", buf)));
 
-    char tmp[128];
-    hstr2ksstr(kstr2hstr((unsigned char *) hwpfont->GetFontName(0, cshape->font[0]), sbuf), tmp);
+    ::std::string const tmp = hstr2ksstr(kstr2hstr(
+        (unsigned char *) hwpfont->GetFontName(0, cshape->font[0])).c_str());
     double fRatio = 1.0;
-    int size = getRepFamilyName(tmp,buf, fRatio);
+    int size = getRepFamilyName(tmp.c_str(), buf, fRatio);
 
     padd(ascii("fo:font-family"), sXML_CDATA,
         OUString(buf, size, RTL_TEXTENCODING_EUC_KR));
@@ -1761,10 +1763,10 @@ void HwpReader::makePageStyle()
 			 if( hwpinfo->back_info.type == 1 ){
 #ifdef _WIN32
 				 padd(ascii("xlink:href"), sXML_CDATA,
-					  hconv(kstr2hstr((uchar *) urltowin(hwpinfo->back_info.filename, buf), sbuf), gstr));
+                      hconv(kstr2hstr((uchar*) urltowin(hwpinfo->back_info.filename).c_str()).c_str()));
 #else
 				 padd(ascii("xlink:href"), sXML_CDATA,
-					hconv(kstr2hstr( (uchar *)urltounix(hwpinfo->back_info.filename, buf), sbuf), gstr));
+                    hconv(kstr2hstr( (uchar *)urltounix(hwpinfo->back_info.filename).c_str()).c_str()));
 #endif
 				 padd(ascii("xlink:type"), sXML_CDATA, ascii("simple"));
 				 padd(ascii("xlink:actuate"), sXML_CDATA, ascii("onLoad"));
@@ -1924,10 +1926,9 @@ void HwpReader::makeTableStyle(Table *tb
     rendEl(ascii("style:style"));
 
 // --------------- column ---------------- //
-    int i ;
-    for( i = 0 ; i < tbl->columns.nCount -1 ; i++ )
+    for (size_t i = 0 ; i < tbl->columns.nCount -1 ; i++)
     {
-        sprintf(buf,"Table%d.%c",hbox->style.boxnum, 'A'+i);
+        sprintf(buf,"Table%d.%c",hbox->style.boxnum, static_cast<char>('A'+i));
         padd(ascii("style:name"), sXML_CDATA, ascii( buf ));
         padd(ascii("style:family"), sXML_CDATA,ascii("table-column"));
         rstartEl(ascii("style:style"), rList);
@@ -1941,9 +1942,9 @@ void HwpReader::makeTableStyle(Table *tb
     }
 
 // --------------- row ---------------- //
-    for( i = 0 ; i < tbl->rows.nCount -1 ; i++ )
+    for (size_t i = 0 ; i < tbl->rows.nCount -1 ; i++)
     {
-        sprintf(buf,"Table%d.row%d",hbox->style.boxnum, i + 1);
+        sprintf(buf,"Table%d.row%ld",hbox->style.boxnum, i + 1);
         padd(ascii("style:name"), sXML_CDATA, ascii( buf ));
         padd(ascii("style:family"), sXML_CDATA,ascii("table-row"));
         rstartEl(ascii("style:style"), rList);
@@ -1957,7 +1958,7 @@ void HwpReader::makeTableStyle(Table *tb
     }
 
 // --------------- cell --------------------- //
-    for( i = 0 ; i < tbl->cells.count(); i++ )
+    for (int i = 0 ; i < tbl->cells.count(); i++)
     {
         TCell *tcell = tbl->cells.find(i);
         sprintf(buf,"Table%d.%c%d",hbox->style.boxnum, 'A'+ tcell->nColumnIndex, tcell->nRowIndex +1);
@@ -2742,14 +2743,10 @@ char *HwpReader::getPStyleName(int index
 }
 
 
-//void HwpReader::makeChars(char *str, int size)
-void HwpReader::makeChars(hchar *str, int size)
+void HwpReader::makeChars(hchar_string & rStr)
 {
-    if (size)
-    {
-        str[size] = '\0';
-        rchars(OUString(str));
-    }
+    rchars(OUString(rStr.c_str()));
+    rStr.clear();
 }
 
 
@@ -2758,8 +2755,9 @@ void HwpReader::makeChars(hchar *str, in
  */
 void HwpReader::make_text_p0(HWPPara * para, sal_Bool bParaStart)
 {
+    hchar_string str;
     int n;
-    int l = 0, res;
+    int res;
 	 hchar dest[3];
     unsigned char firstspace = 0;
     if( !bParaStart)
@@ -2793,15 +2791,13 @@ void HwpReader::make_text_p0(HWPPara * p
     {
         if (para->hhstr[n]->hh == CH_SPACE && !firstspace)
         {
-            makeChars(gstr, l);
-            l = 0;
+            makeChars(str);
             rstartEl(ascii("text:s"), rList);
             rendEl(ascii("text:s"));
         }
         else if (para->hhstr[n]->hh == CH_END_PARA)
         {
-            makeChars(gstr, l);
-            l = 0;
+            makeChars(str);
             rendEl(ascii("text:span"));
             rendEl(ascii("text:p"));
             break;
@@ -2814,7 +2810,9 @@ void HwpReader::make_text_p0(HWPPara * p
                 firstspace = 1;
 				res = hcharconv(para->hhstr[n]->hh, dest, UNICODE);
 				for( int j = 0 ; j < res; j++ )
-					gstr[l++] =  dest[j];
+                {
+                    str.push_back(dest[j]);
+                }
         }
     }
 }
@@ -2825,8 +2823,9 @@ void HwpReader::make_text_p0(HWPPara * p
  */
 void HwpReader::make_text_p1(HWPPara * para,sal_Bool bParaStart)
 {
+    hchar_string str;
     int n;
-    int l = 0, res;
+    int res;
 	 hchar dest[3];
     int curr = para->cshape.index;
     unsigned char firstspace = 0;
@@ -2863,8 +2862,7 @@ void HwpReader::make_text_p1(HWPPara * p
     {
         if (para->GetCharShape(n)->index != curr)
         {
-            makeChars(gstr, l);
-            l = 0;
+            makeChars(str);
             rendEl(ascii("text:span"));
             curr = para->GetCharShape(n)->index;
             padd(ascii("text:style-name"), sXML_CDATA,
@@ -2874,15 +2872,13 @@ void HwpReader::make_text_p1(HWPPara * p
         }
         if (para->hhstr[n]->hh == CH_SPACE && !firstspace)
         {
-            makeChars(gstr, l);
-            l = 0;
+            makeChars(str);
             rstartEl(ascii("text:s"), rList);
             rendEl(ascii("text:s"));
         }
         else if (para->hhstr[n]->hh == CH_END_PARA)
         {
-            makeChars(gstr, l);
-            l = 0;
+            makeChars(str);
             rendEl(ascii("text:span"));
             rendEl(ascii("text:p"));
             break;
@@ -2897,7 +2893,9 @@ void HwpReader::make_text_p1(HWPPara * p
                 firstspace = 1;
 				res = hcharconv(para->hhstr[n]->hh, dest, UNICODE);
 				for( int j = 0 ; j < res; j++ )
-					gstr[l++] =  dest[j];
+                {
+                    str.push_back(dest[j]);
+                }
         }
     }
 }
@@ -2908,9 +2906,9 @@ void HwpReader::make_text_p1(HWPPara * p
  */
 void HwpReader::make_text_p3(HWPPara * para,sal_Bool bParaStart)
 {
+    hchar_string str;
     int n, res;
 	 hchar dest[3];
-    size_t l = 0;
     unsigned char firstspace = 0;
     bool pstart = bParaStart;
     bool tstart = false;
@@ -2940,12 +2938,11 @@ void HwpReader::make_text_p3(HWPPara * p
     {
         if( para->hhstr[n]->hh == CH_END_PARA )
         {
-            if( l > 0 )
+            if (str.size() > 0)
             {
                 if( !pstart ){ STARTP;}
                 if( !tstart ){ STARTT;}
-                makeChars(gstr, l);
-                l = 0;
+                makeChars(str);
             }
             if( tstart ){ ENDT;}
             if( !pstart ){ STARTP;}
@@ -2956,8 +2953,7 @@ void HwpReader::make_text_p3(HWPPara * p
         {
             if( !pstart ) {STARTP;}
             if( !tstart ) {STARTT;}
-            makeChars(gstr, l);
-            l = 0;
+            makeChars(str);
             rstartEl(ascii("text:s"), rList);
             pList->clear();
             rendEl(ascii("text:s"));
@@ -2969,9 +2965,8 @@ void HwpReader::make_text_p3(HWPPara * p
 					{
 						 if( !pstart ) {STARTP;}
 						 if( !tstart ) {STARTT;}
-						 makeChars(gstr, l);
+                         makeChars(str);
 						 ENDT;
-						 l = 0;
 					}
             if( para->hhstr[n]->hh == CH_SPACE )
                 firstspace = 0;
@@ -2979,7 +2974,9 @@ void HwpReader::make_text_p3(HWPPara * p
                 firstspace = 1;
 				res = hcharconv(para->hhstr[n]->hh, dest, UNICODE);
 				for( int j = 0 ; j < res; j++ )
-					gstr[l++] =  dest[j];
+                {
+                    str.push_back(dest[j]);
+                }
         }
         else if (para->hhstr[n]->hh == CH_FIELD)
         {
@@ -2988,15 +2985,14 @@ void HwpReader::make_text_p3(HWPPara * p
             {
                 if( !pstart ) {STARTP;}
                 if( !tstart ) {STARTT;}
-                makeChars(gstr, l);
-                l = 0;
+                makeChars(str);
                 firstspace = 1;
 					 if( hbox->type[0] == 4 && hbox->type[1] == 0 )
 					 {
 						 field = hbox->str3;
 					 }
 					 else{
-						 makeFieldCode(hbox);
+                         makeFieldCode(str, hbox);
 					 }
                 infield = true;
             }
@@ -3005,12 +3001,11 @@ void HwpReader::make_text_p3(HWPPara * p
                 firstspace = 1;
 					 if( hbox->type[0] == 4 && hbox->type[1] == 0 )
 					 {
-						 gstr[l] = 0;
-						 makeFieldCode(hbox);
+                         makeFieldCode(str, hbox);
 						 field = 0L;
 					 }
                 infield = false;
-                l = 0;
+                str.clear();
             }
         }
         else
@@ -3020,8 +3015,7 @@ void HwpReader::make_text_p3(HWPPara * p
                 case CH_BOOKMARK:
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeBookmark((Bookmark *) para->hhstr[n]);
                     break;
                 case CH_DATE_FORM:                // 7
@@ -3029,17 +3023,15 @@ void HwpReader::make_text_p3(HWPPara * p
                 case CH_DATE_CODE:                // 8
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeDateCode((DateCode *) para->hhstr[n]);
                     break;
                 case CH_TAB:                      // 9
                     if( !pstart ) {STARTP;}
-                    if( l > 0 )
+                    if (str.size() > 0)
                     {
                         if( !tstart ) {STARTT;}
-                        makeChars(gstr, l);
-                        l = 0;
+                        makeChars(str);
                     }
                     makeTab((Tab *) para->hhstr[n]);
                     break;
@@ -3052,17 +3044,15 @@ void HwpReader::make_text_p3(HWPPara * p
                     {
                         if( !pstart ) {STARTP;}
                         if( !tstart ) {STARTT;}
-                        makeChars(gstr, l);
-                        l = 0;
+                        makeChars(str);
                     }
                     else
                     {
                         if( !pstart ) {STARTP;}
-                        if( l > 0 )
+                        if (str.size() > 0)
                         {
                             if( !tstart ) {STARTT;}
-                            makeChars(gstr, l);
-                            l = 0;
+                            makeChars(str);
                         }
                         if( tstart ) {ENDT;}
                     }
@@ -3087,17 +3077,15 @@ void HwpReader::make_text_p3(HWPPara * p
                     {
                         if( !pstart ) {STARTP;}
                         if( !tstart ) {STARTT;}
-                        makeChars(gstr, l);
-                        l = 0;
+                        makeChars(str);
                     }
                     else
                     {
                         if( !pstart ) {STARTP;}
-                        if( l > 0 )
+                        if (str.size() > 0)
                         {
                             if( !tstart ) {STARTT;}
-                            makeChars(gstr, l);
-                            l = 0;
+                            makeChars(str);
                         }
                         if( tstart ) {ENDT;}
                     }
@@ -3107,12 +3095,11 @@ void HwpReader::make_text_p3(HWPPara * p
                 case CH_LINE:                     // 14
                 {
                     Line *hbox = (Line *) para->hhstr[n];
-                    if( l > 0 )
+                    if (str.size() > 0)
                     {
                         if( !pstart ) {STARTP;}
                         if( !tstart ) {STARTT;}
-                        makeChars(gstr, l);
-                        l = 0;
+                        makeChars(str);
                     }
                     if( tstart ) {ENDT;}
                     if( pstart ) {ENDP;}
@@ -3123,22 +3110,19 @@ void HwpReader::make_text_p3(HWPPara * p
                 case CH_HIDDEN:                   // 15
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeHidden((Hidden *) para->hhstr[n]);
                     break;
                 case CH_FOOTNOTE:                 // 17
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeFootnote((Footnote *) para->hhstr[n]);
                     break;
                 case CH_AUTO_NUM:                 // 18
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeAutoNum((AutoNum *) para->hhstr[n]);
                     break;
                 case CH_NEW_NUM:                  // 19 -skip
@@ -3148,8 +3132,7 @@ void HwpReader::make_text_p3(HWPPara * p
                 case CH_MAIL_MERGE:               // 22
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeMailMerge((MailMerge *) para->hhstr[n]);
                     break;
                 case CH_COMPOSE:                  /* 23 - ???????? */
@@ -3159,27 +3142,24 @@ void HwpReader::make_text_p3(HWPPara * p
                 case CH_TOC_MARK:                 /* 25 ?????? 3???? ???????? ????. */
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeTocMark((TocMark *) para->hhstr[n]);
                     break;
                 case CH_INDEX_MARK:               // 26
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeIndexMark((IndexMark *) para->hhstr[n]);
                     break;
                 case CH_OUTLINE:                  // 28
                     if( !pstart ) {STARTP;}
                     if( !tstart ) {STARTT;}
-                    makeChars(gstr, l);
-                    l = 0;
+                    makeChars(str);
                     makeOutline((Outline *) para->hhstr[n]);
                     break;
 					 case CH_FIXED_SPACE:
 					 case CH_KEEP_SPACE:
-						  gstr[l++] = 0x0020;
+                          str.push_back(0x0020);
 						  break;
 				}
         }
@@ -3187,108 +3167,108 @@ void HwpReader::make_text_p3(HWPPara * p
 }
 
 
-void HwpReader::makeFieldCode(FieldCode *hbox)
+void HwpReader::makeFieldCode(hchar_string & rStr, FieldCode *hbox)
 {
 /* ?????? */
     if( hbox->type[0] == 4 && hbox->type[1] == 0 )
     {
         padd(ascii("text:placeholder-type"), sXML_CDATA, ascii("text"));
 		  if( field )
-			  padd(ascii("text:description"), sXML_CDATA, hconv(field, sbuf));
+			  padd(ascii("text:description"), sXML_CDATA, hconv(field));
         rstartEl( ascii("text:placeholder"), rList);
         pList->clear();
-        rchars( OUString(gstr));
+        rchars( OUString(rStr.c_str()) );
         rendEl( ascii("text:placeholder") );
     }
 /* ???????? */
     else if( hbox->type[0] == 3 && hbox->type[1] == 0 )
     {
-        if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("title")))
+        if (hconv(hbox->str3).equals(OUString::createFromAscii("title")))
         {
             rstartEl( ascii("text:title"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:title") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("subject")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("subject")))
         {
             rstartEl( ascii("text:subject"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:subject") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("author")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("author")))
         {
             rstartEl( ascii("text:author-name"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:author-name") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("keywords")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("keywords")))
         {
             rstartEl( ascii("text:keywords"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:keywords") );
         }
     }
 /* ???????? */
     else if( hbox->type[0] == 3 && hbox->type[1] == 1 )
     {
-        if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("User")))
+        if (hconv(hbox->str3).equals(OUString::createFromAscii("User")))
         {
             rstartEl( ascii("text:sender-lastname"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-lastname") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Company")))
+        else if (hconv( hbox->str3).equals(OUString::createFromAscii("Company")))
         {
             rstartEl( ascii("text:sender-company"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-company") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Position")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Position")))
         {
             rstartEl( ascii("text:sender-title"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-title") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Division")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Division")))
         {
             rstartEl( ascii("text:sender-position"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-position") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Fax")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Fax")))
         {
             rstartEl( ascii("text:sender-fax"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-fax") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Pager")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Pager")))
         {
             rstartEl( ascii("text:phone-private"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:phone-private") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("E-mail")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("E-mail")))
         {
             rstartEl( ascii("text:sender-email"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-email") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Zipcode(office)")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Zipcode(office)")))
         {
             rstartEl( ascii("text:sender-postal-code"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-postal-code") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Phone(office)")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Phone(office)")))
         {
             rstartEl( ascii("text:sender-phone-work"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-phone-work") );
         }
-        else if( hconv( hbox->str3, gstr ).equals(OUString::createFromAscii("Address(office)")))
+        else if (hconv(hbox->str3).equals(OUString::createFromAscii("Address(office)")))
         {
             rstartEl( ascii("text:sender-street"), rList );
-            rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
             rendEl( ascii("text:sender-street") );
         }
 
@@ -3300,7 +3280,7 @@ void HwpReader::makeFieldCode(FieldCode 
 					 ascii(Int2Str(hbox->m_pDate->key, "N%d", buf)));
 			rstartEl( ascii("text:creation-date"), rList );
 			pList->clear();
-			rchars(  hconv(hbox->str2, gstr) );
+            rchars(  hconv(hbox->str2) );
 			rendEl( ascii("text:creation-date") );
 	 }
 }
@@ -3314,21 +3294,21 @@ void HwpReader::makeBookmark(Bookmark * 
 {
     if (hbox->type == 0)
     {
-        padd(ascii("text:name"), sXML_CDATA, (hconv(hbox->id, gstr)));
+        padd(ascii("text:name"), sXML_CDATA, (hconv(hbox->id)));
         rstartEl(ascii("text:bookmark"), rList);
         pList->clear();
         rendEl(ascii("text:bookmark"));
     }
     else if (hbox->type == 1)                     /* ???? ???????? ???? ?????? ???? ???? */
     {
-        padd(ascii("text:name"), sXML_CDATA, (hconv(hbox->id, gstr)));
+        padd(ascii("text:name"), sXML_CDATA, (hconv(hbox->id)));
         rstartEl(ascii("text:bookmark-start"), rList);
         pList->clear();
         rendEl(ascii("text:bookmark-start"));
     }
     else if (hbox->type == 2)
     {
-        padd(ascii("text:name"), sXML_CDATA, (hconv(hbox->id, gstr)));
+        padd(ascii("text:name"), sXML_CDATA, (hconv(hbox->id)));
         rstartEl(ascii("text:bookmark-end"), rList);
         pList->clear();
         rendEl(ascii("text:bookmark-end"));
@@ -3485,10 +3465,11 @@ if( *fmt == '6' ){
 */
                 break;
             default:
+                hchar sbuf[2];
                 sbuf[0] = *fmt;
                 sbuf[1] = 0;
                 rstartEl(ascii("number:text"), rList);
-                rchars((hconv(sbuf, gstr)));
+                rchars((hconv(sbuf)));
                 rendEl(ascii("number:text"));
                 break;
         }
@@ -3504,8 +3485,8 @@ void HwpReader::makeDateCode(DateCode * 
         ascii(Int2Str(hbox->key, "N%d", buf)));
     rstartEl( ascii("text:date"), rList );
     pList->clear();
-    hbox->GetString(sbuf, 255);
-    rchars((hconv(sbuf, gstr)));
+    hchar_string const boxstr = hbox->GetString();
+    rchars((hconv(boxstr.c_str())));
     rendEl( ascii("text:date") );
 }
 
@@ -3528,10 +3509,9 @@ void HwpReader::makeTable(TxtBox * hbox)
 
     Table *tbl = hbox->m_pTable;
 // ----------- column ---------------- //
-    int i ;
-    for( i = 0 ; i < tbl->columns.nCount -1 ; i++ )
+    for (size_t i = 0 ; i < tbl->columns.nCount -1 ; i++)
     {
-        sprintf(buf,"Table%d.%c",hbox->style.boxnum, 'A'+i);
+        sprintf(buf,"Table%d.%c",hbox->style.boxnum, static_cast<char>('A'+i));
         padd(ascii("table:style-name"), sXML_CDATA, ascii( buf ));
         rstartEl(ascii("table:table-column"), rList);
         pList->clear();
@@ -3540,7 +3520,7 @@ void HwpReader::makeTable(TxtBox * hbox)
 
 // ----------- cell ---------------- //
     int j = -1, k = -1;
-    for( i = 0 ; i < tbl->cells.count(); i++ )
+    for (int i = 0 ; i < tbl->cells.count(); i++)
     {
         TCell *tcell = tbl->cells.find(i);
         if( tcell->nRowIndex > j )
@@ -3760,7 +3740,7 @@ void HwpReader::makeFormula(TxtBox * hbo
         {
             if (!cshape)
                 cshape = pPar->GetCharShape(n);
-            if (l >= sizeof(mybuf)-1)
+            if (l >= sizeof(mybuf)-7)
                 break;
 				res = hcharconv(pPar->hhstr[n]->hh, dest, UNICODE);
 				for( int j = 0 ; j < res; j++ ){
@@ -3776,7 +3756,7 @@ void HwpReader::makeFormula(TxtBox * hbo
 					}
 				}
         }
-        if (l >= sizeof(mybuf)-1)
+        if (l >= sizeof(mybuf)-7)
             break;
         mybuf[l++] = '\n';
         pPar = pPar->Next();
@@ -3807,32 +3787,35 @@ void HwpReader::makeHyperText(TxtBox * h
 	 if( !hypert ) return;
 
     if( strlen((char *)hypert->filename) > 0 ){
-			  char tmp[256];
-			  char tmp2[256];
-			  int nSize = hstr2ksstr(hypert->bookmark, tmp);
+              ::std::string const tmp = hstr2ksstr(hypert->bookmark);
+              ::std::string const tmp2 = hstr2ksstr(kstr2hstr(
 #ifdef _WIN32
-        	  int nSize2 = hstr2ksstr(kstr2hstr((uchar *) urltowin((char *)hypert->filename, buf), sbuf), tmp2);
+                  (uchar *) urltowin((char *)hypert->filename).c_str()).c_str());
 #else
-			  int nSize2 = hstr2ksstr(kstr2hstr( (uchar *)urltounix((char *)hypert->filename, buf), sbuf), tmp2);
+                  (uchar *) urltounix((char *)hypert->filename).c_str()).c_str());
 #endif
 		  padd(ascii("xlink:type"), sXML_CDATA, ascii("simple"));
-		  if( strlen(tmp) > 0 && strcmp( tmp, "[HTML]") ){
-			  sprintf( buf, "%s#%s",tmp2, tmp);
-			  padd(ascii("xlink:href"), sXML_CDATA, OUString(buf, nSize2 + nSize+1, RTL_TEXTENCODING_EUC_KR));
+          if (tmp.size() > 0 && strcmp(tmp.c_str(), "[HTML]")) {
+              ::std::string tmp3(tmp2);
+              tmp3.push_back('#');
+              tmp3.append(tmp);
+              padd(ascii("xlink:href"), sXML_CDATA,
+                  OUString(tmp3.c_str(), tmp3.size()+1, RTL_TEXTENCODING_EUC_KR));
 		  }
 		  else{
-			  sprintf( buf, "%s",tmp2);
-			  padd(ascii("xlink:href"), sXML_CDATA, OUString(buf, nSize2, RTL_TEXTENCODING_EUC_KR));
+              padd(ascii("xlink:href"), sXML_CDATA,
+                  OUString(tmp2.c_str(), tmp2.size()+1, RTL_TEXTENCODING_EUC_KR));
 
 		  }
 	 }
     else
     {
-        char tmp[256];
         padd(ascii("xlink:type"), sXML_CDATA, ascii("simple"));
-        int nSize = hstr2ksstr(hypert->bookmark, tmp);
-        sprintf( buf, "#%s", tmp);
-        padd(ascii("xlink:href"), sXML_CDATA, OUString(buf, nSize+1, RTL_TEXTENCODING_EUC_KR));
+        ::std::string tmp;
+        tmp.push_back('#');
+        tmp.append(hstr2ksstr(hypert->bookmark));
+        padd(ascii("xlink:href"), sXML_CDATA,
+                OUString(tmp.c_str(), tmp.size()+1, RTL_TEXTENCODING_EUC_KR));
     }
     rstartEl(ascii("draw:a"), rList);
     pList->clear();
@@ -3907,16 +3890,16 @@ void HwpReader::makePicture(Picture * hb
                 padd(ascii("xlink:type"), sXML_CDATA, ascii("simple"));
 #ifdef _WIN32
                 if( hbox->follow[4] != 0 )
-                    padd(ascii("xlink:href"), sXML_CDATA, (hconv(kstr2hstr(hbox->follow + 4, sbuf), gstr)));
+                    padd(ascii("xlink:href"), sXML_CDATA, (hconv(kstr2hstr(hbox->follow + 4).c_str())));
                 else
-                    padd(ascii("xlink:href"), sXML_CDATA, (hconv(kstr2hstr(hbox->follow + 5, sbuf), gstr)));
+                    padd(ascii("xlink:href"), sXML_CDATA, (hconv(kstr2hstr(hbox->follow + 5).c_str())));
 #else
                 if( hbox->follow[4] != 0 )
                     padd(ascii("xlink:href"), sXML_CDATA,
-                        (hconv(kstr2hstr((uchar *)urltounix((char *)(hbox->follow + 4), buf), sbuf), gstr)));
+                        (hconv(kstr2hstr((uchar *)urltounix((char *)(hbox->follow + 4)).c_str()).c_str())));
                 else
                     padd(ascii("xlink:href"), sXML_CDATA,
-                        (hconv(kstr2hstr((uchar *)urltounix((char *)(hbox->follow + 5), buf), sbuf), gstr)));
+                        (hconv(kstr2hstr((uchar *)urltounix((char *)(hbox->follow + 5)).c_str()).c_str())));
 #endif
                 rstartEl(ascii("draw:a"), rList);
                 pList->clear();
@@ -3974,10 +3957,10 @@ void HwpReader::makePicture(Picture * hb
             if ( hbox->pictype == PICTYPE_FILE ){
 #ifdef _WIN32
                 sprintf(buf, "file:///%s", hbox->picinfo.picun.path );
-                padd(ascii("xlink:href"), sXML_CDATA, (hconv(kstr2hstr((uchar *) buf, sbuf), gstr)));
+                padd(ascii("xlink:href"), sXML_CDATA, (hconv(kstr2hstr((uchar *) buf).c_str())));
 #else
                 padd(ascii("xlink:href"), sXML_CDATA,
-                    (hconv(kstr2hstr((uchar *) urltounix( hbox->picinfo.picun.path, buf), sbuf), gstr)));
+                    (hconv(kstr2hstr((uchar *) urltounix(hbox->picinfo.picun.path).c_str()).c_str())));
 #endif
                 padd(ascii("xlink:type"), sXML_CDATA, ascii("simple"));
                 padd(ascii("xlink:show"), sXML_CDATA, ascii("embed"));
@@ -4440,7 +4423,10 @@ void HwpReader::makePictureDRAW(HWPDrawi
 
                     OUString oustr;
 
-                    if (drawobj->u.freeform.npt > 2){
+                    if ((drawobj->u.freeform.npt > 2) &&
+                        (static_cast<size_t>(drawobj->u.freeform.npt) <
+                         (::std::numeric_limits<int>::max() / sizeof(double))))
+                    {
 							  int n, i;
 							  if( bIsNatural == sal_True )
 								  n = drawobj->u.freeform.npt;
@@ -4682,7 +4668,8 @@ void HwpReader::makeLine(Line *   )
  */
 void HwpReader::makeHidden(Hidden * hbox)
 {
-    int l = 0, res;
+    hchar_string str;
+    int res;
 	 hchar dest[3];
 
     padd(ascii("text:condition"), sXML_CDATA, ascii(""));
@@ -4698,11 +4685,13 @@ void HwpReader::makeHidden(Hidden * hbox
         {
 			  res = hcharconv(para->hhstr[n]->hh, dest, UNICODE);
 			  for( int j = 0 ; j < res ; j++ )
-					gstr[l++] = dest[j];
+              {
+                    str.push_back(dest[j]);
+              }
         }
         para = para->Next();
     }
-    makeChars(gstr, l);
+    makeChars(str);
     rendEl(ascii("text:hidden-text"));
 }
 
@@ -4865,8 +4854,8 @@ void HwpReader::makeShowPageNum()
  */
 void HwpReader::makeMailMerge(MailMerge * hbox)
 {
-    hbox->GetString(sbuf, 255);
-    rchars((hconv(sbuf, gstr)));
+    hchar_string const boxstr = hbox->GetString();
+    rchars((hconv(boxstr.c_str())));
 }
 
 
@@ -4891,7 +4880,7 @@ void HwpReader::makeIndexMark(IndexMark 
 void HwpReader::makeOutline(Outline * hbox)
 {
 	if( hbox->kind == 1 )
-		 rchars(OUString(hbox->GetUnicode(sbuf, 255)));
+        rchars(OUString(hbox->GetUnicode().c_str()));
 }
 
 

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.hxx?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.hxx (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/hwpreader.hxx Fri Jul 20 12:24:22 2012
@@ -162,10 +162,10 @@ private:
     void make_text_p3(HWPPara *para, sal_Bool bParaStart = sal_False);
 
     /* -------- rDocument->characters(x) --------- */
-    void makeChars(hchar *, int);
+    void makeChars(hchar_string & rStr);
 
     /* -------- Special Char Parsing --------- */
-    void makeFieldCode(FieldCode *hbox);		//6
+    void makeFieldCode(hchar_string & rStr, FieldCode *hbox);		//6
     void makeBookmark(Bookmark *hbox);		//6
     void makeDateFormat(DateCode *hbox);	//7
     void makeDateCode(DateCode *hbox);		//8

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/makefile.mk?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/makefile.mk (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/makefile.mk Fri Jul 20 12:24:22 2012
@@ -49,7 +49,6 @@ SLOFILES =	\
 		$(SLO)$/hcode.obj \
 		$(SLO)$/hfont.obj \
 		$(SLO)$/hgzip.obj \
-		$(SLO)$/himgutil.obj \
 		$(SLO)$/hinfo.obj \
 		$(SLO)$/hiodev.obj \
 		$(SLO)$/hpara.obj \

Modified: incubator/ooo/branches/AOO34/main/hwpfilter/source/mapping.h
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/AOO34/main/hwpfilter/source/mapping.h?rev=1363749&r1=1363748&r2=1363749&view=diff
==============================================================================
--- incubator/ooo/branches/AOO34/main/hwpfilter/source/mapping.h (original)
+++ incubator/ooo/branches/AOO34/main/hwpfilter/source/mapping.h Fri Jul 20 12:24:22 2012
@@ -27,7 +27,8 @@
 #include <string.h>
 #include <stdio.h>
 
-typedef unsigned short hchar;
+#include <hwplib.h>
+
 
 struct FormulaEntry{
 	 const char *tex;
@@ -363,30 +364,31 @@ const struct FormulaEntry FormulaMapTab[
 };
 
 #ifndef DEBUG
-hchar *getMathMLEntity(const char *tex, hchar *buf)
+hchar_string getMathMLEntity(const char *tex)
 {
-	 static int tabSize = sizeof( FormulaMapTab ) / sizeof( FormulaMapTab[0] );
-	 int i, len;
-	 
-	 for( i = 0 ; i < tabSize ; i++ ){
+     static size_t tabSize = sizeof(FormulaMapTab) / sizeof(FormulaMapTab[0]);
+
+     hchar_string buf;
+	 for (size_t i = 0 ; i < tabSize ; i++) {
 		  if( !strcmp(tex, FormulaMapTab[i].tex ) ) {
-				buf[0] = FormulaMapTab[i].ucs;
-				buf[1] = '\0';
-				return buf;
+                buf.push_back(FormulaMapTab[i].ucs);
+                return buf;
 		  }
 	 }
-	 len = strlen(tex);
 
-	 for( i = 0 ; i < len ; i++ )
-		  buf[i] = tex[i];
-	 buf[len] = 0;
+     size_t const len = strlen(tex);
+	 for (size_t i = 0 ; i < len ; i++)
+     {
+         buf.push_back(tex[i]);
+     }
 	 return buf;
 }
 
 #else
-char *getMathMLEntity(const char *tex, char *buf)
+::std::string getMathMLEntity(const char *tex)
 {
-	 strcpy(buf,tex);
+     ::std::string buf;
+     buf.append(tex);
 	 return buf;
 }
 #endif



Mime
View raw message