Looking at the below, I can't help feel like extending ut_string_class
with something like:

 UT_UCS2String::UT_UCS2String(const UT_String* rhs)

allowing to avoid the error-prone alloc/free used in the code below.

Jesper


Index: xp/AbiCommand.cpp
===================================================================
RCS file: /cvsroot/abiword-plugins/tools/abicommand/xp/AbiCommand.cpp,v
retrieving revision 1.9
diff -u -u -5 -r1.9 AbiCommand.cpp
--- xp/AbiCommand.cpp   26 Apr 2002 12:58:05 -0000      1.9
+++ xp/AbiCommand.cpp   28 Apr 2002 14:29:52 -0000
@@ -886,11 +886,13 @@
 {
        if(m_pCurView != NULL && pToks->getItemCount() > 1)
        {
                UT_String * pText = (UT_String *) pToks->getNthItem(1);
                UT_UCSChar * pUCSText = (UT_UCSChar *) 
UT_calloc(pText->size()+1,sizeof(UT_UCSChar));
+               UT_UCS_strcpy_char(pUCSText, pText->c_str());
                static_cast<FV_View 
*>(m_pCurView)->cmdCharInsert(pUCSText,pText->size());
+               FREEP(pUCSText);
                return true;
        }
        return false;
 }
 //

Reply via email to