commmit - fix AbiCommand inserttext [& UT_UCS2String question]

From: Jesper Skov (jskov@zoftcorp.dk)
Date: Sun Apr 28 2002 - 10:33:34 EDT

  • Next message: Kenneth J.Davis: "Re: Release cycle (was Re: New development plans)"

    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;
     }
     //



    This archive was generated by hypermail 2.1.4 : Sun Apr 28 2002 - 10:32:28 EDT