Changeset 120

Show
Ignore:
Timestamp:
02/18/08 09:21:22 (10 months ago)
Author:
psmedley
Message:

Changes from KO to address Ticket #20

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/lib/charcnv.c

    r105 r120  
    14251425    uint8_t buf[4]; 
    14261426    smb_iconv_t descriptor; 
     1427#ifdef __OS2__ 
     1428    size_t ilen_max; 
     1429#endif 
    14271430    size_t ilen_orig; 
    14281431    size_t ilen; 
     
    14321435    char *outbuf; 
    14331436 
     1437#ifdef __OS2__ 
     1438    *size = 1; 
     1439#endif 
     1440 
    14341441    if ((str[0] & 0x80) == 0) { 
     1442#ifndef __OS2__ 
    14351443        *size = 1; 
     1444#endif 
    14361445        return (codepoint_t)str[0]; 
    14371446    } 
     
    14411450    descriptor = conv_handles[CH_UNIX][CH_UTF16LE]; 
    14421451    if (descriptor == (smb_iconv_t)-1 || descriptor == (smb_iconv_t)0) { 
     1452#ifndef __OS2__ 
    14431453        *size = 1; 
     1454#endif 
    14441455        return INVALID_CODEPOINT; 
    14451456    } 
    1446  
     1457#ifdef __OS2__ 
     1458    /* We assume that no multi-byte character can take 
     1459       more than 5 bytes. This is OK as we only 
     1460       support codepoints up to 1M */ 
     1461 
     1462    ilen_max = strnlen( str, 5 ); 
     1463#else 
    14471464    *size = 1; 
     1465#endif 
    14481466    ilen_orig = 1; 
    14491467    olen_orig = 2; 
     
    14671485 
    14681486            case EINVAL : 
     1487#ifndef __OS2__ 
    14691488                /* We assume that no multi-byte character can take 
    14701489                   more than 5 bytes. This is OK as we only 
    14711490                   support codepoints up to 1M */ 
    14721491                if( ilen_orig < 5 ) 
     1492#else 
     1493                if( ilen_orig < ilen_max ) 
     1494#endif 
    14731495                    ilen_orig++; 
    14741496                else