Ignore:
Timestamp:
Jun 3, 2006, 9:53:58 AM (16 years ago)
Author:
Eugene Romanenko
Message:

fixed crash on copying large block of text to clipboard

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/plugins/ludoc/cpconv.cpp

    r35 r37  
    141141}
    142142
     143// convert one char
    143144int cpconv::conv( int chfrom )
    144145{
     
    181182
    182183    sl =  *in_left;
    183     ucs = (UniChar *) alloca(sl * sizeof(UniChar));
     184    ucs = new UniChar[ sl ];
    184185    orig_ucs = ucs;
    185186
    186     rc = UniUconvToUcs(objtoucs, (void **)in, in_left, &ucs, &sl, &retval);
    187     if (rc) {
    188         goto error;
    189     }
     187    rc = UniUconvToUcs( objtoucs, (void **)in, in_left, &ucs, &sl, &retval );
     188    if ( rc != 0 ) {
     189        delete ucs;
     190        err = 1;
     191        return -1;
     192    }
     193
    190194    sl = ucs - orig_ucs;
    191195    ucs = orig_ucs;
    192     rc = UniUconvFromUcs(objfromucs, &ucs, &sl, (void **)out, out_left, &nonid);
    193     if (rc) {
    194         goto error;
    195     }
     196    rc = UniUconvFromUcs( objfromucs, &ucs, &sl, (void **)out, out_left, &nonid );
     197    delete ucs;
     198
     199    if ( rc != 0 ) {
     200        err = 1;
     201        return -1;
     202    }
     203
    196204    retval += nonid;
    197205    return 0;
    198 
    199 error:
    200     err = 1;
    201     return -1;
    202206}
    203207
     
    224228
    225229
     230// Converts special non-ascii chars to suitable ascii chars
    226231static void convSpchars( UniChar *uni )
    227232{
    228233    while ( *uni )
    229234    {
    230 //printf( ":%x:", *uni );
    231235        switch ( *uni )
    232236        {
     
    248252        *uni++;
    249253    }
    250 //printf( "\n" );
    251254}
    252255
     
    317320    unsigned in_len = strlen( testutf8 );
    318321    unsigned out_len = sizeof( buf );
    319    
     322
    320323    cnvUTF8ToUCS4( &testutf8, &in_len, &buf1, &out_len );
    321    
     324
    322325    for ( int i = 0; i<100; i++ )
    323326    {
Note: See TracChangeset for help on using the changeset viewer.