Changeset 337 for branches


Ignore:
Timestamp:
Oct 8, 2009, 8:01:00 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

divers fix for Ticket #68 in 3.0

Location:
branches/samba-3.0/source/lib
Files:
2 edited

Legend:

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

    r236 r337  
    5656{
    5757        const char *ret = NULL;
    58 #ifndef __OS2__
    5958        if (ch == CH_UTF16LE) ret = "UTF-16LE";
    6059        else if (ch == CH_UTF16BE) ret = "UTF-16BE";
    61 #else
    62         if (ch == CH_UTF16LE) ret = "IBM-1200";
    63         else if (ch == CH_UTF16BE) ret = "IBM-1200";
    64 #endif
    6560        else if (ch == CH_UNIX) ret = lp_unix_charset();
    6661        else if (ch == CH_DOS) ret = lp_dos_charset();
     
    9388
    9489        if (!ret || !*ret) ret = "ASCII";
    95         DEBUG(10, ("codepage: %s\n",ret));
    9690        return ret;
    9791}
     
    397391                return 0;
    398392
    399 //      DEBUG(10, ("convert_string: 1"));
    400 
    401393        if (from != CH_UTF16LE && from != CH_UTF16BE && to != CH_UTF16LE && to != CH_UTF16BE) {
    402394                const unsigned char *p = (const unsigned char *)src;
     
    406398                unsigned char lastp = '\0';
    407399                size_t retval = 0;
    408 
    409 //      DEBUG(10, ("convert_string: 2"));
    410400
    411401                /* If all characters are ascii, fast path here. */
     
    436426                }
    437427                return retval;
    438 //              DEBUG(10, ("convert_string: 3"));
    439428
    440429        } else if (from == CH_UTF16LE && to != CH_UTF16LE) {
     
    462451                                goto general_case;
    463452#else
    464                                 return retval + convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
     453                return retval + convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
    465454#endif
    466455                        }
     
    474463                }
    475464                return retval;
    476 //              DEBUG(10, ("convert_string: 4"));
    477465
    478466        } else if (from != CH_UTF16LE && from != CH_UTF16BE && to == CH_UTF16LE) {
     
    517505  general_case:
    518506#endif
     507
    519508        return convert_string_internal(from, to, src, srclen, dest, destlen, allow_bad_conv);
    520509}
     
    593582
    594583 again:
    595         DEBUG(10,("convert_string_internal: convert_string(%s,%s): srclen=%u destlen=%u\n",
    596         charset_name(from), charset_name(to),
    597         (unsigned int)srclen, (unsigned int)destlen));
    598584
    599585        retval = smb_iconv(descriptor,
  • branches/samba-3.0/source/lib/iconv.c

    r165 r337  
    129129}
    130130
     131#ifdef __OS2__
     132// i could have done a static variable w/o this function. but i feel it's nicer this way. SCS
     133// the purpose of this function is to save the to_name to get the korean and japanese code set working
     134char * save_toname(char *toname, bool what)
     135{
     136   static char *to_name=NULL;
     137
     138   if ( what == 0 )
     139        to_name = SMB_STRDUP(toname);
     140
     141        return to_name;
     142}
     143#endif
     144
    131145#ifdef HAVE_NATIVE_ICONV
    132146/* if there was an error then reset the internal state,
     
    139153#ifdef __OS2__
    140154        uint16 *outbuf_uc = ( uint16 * )*outbuf;
     155        char *to_name = save_toname(NULL, 1);
    141156#endif
    142157
     
    153168        else
    154169        {
     170        if( (strstr(to_name, "949") != NULL) ||     /* Korean CP */
     171                   (strstr(to_name, "932") != NULL) ||      /* Japanese CP */
     172                   (strstr(to_name, "942") != NULL) ||      /* Japanese CP */
     173                   (strstr(to_name, "943") != NULL) )       /* Japanese CP */
     174        {
    155175        while(( char * )outbuf_uc < *outbuf )
    156176        {
     
    160180
    161181            outbuf_uc++;
     182        }
    162183        }
    163184        }
     
    181202        size_t bufsize;
    182203
     204#ifdef __OS2__
     205        save_toname(cd->to_name, 0);
     206#endif
     207
    183208        /* in many cases we can go direct */
    184209        if (cd->direct) {
     
    195220                if (cd->pull(cd->cd_pull,
    196221                             inbuf, inbytesleft, &bufp, &bufsize) == -1
    197                     && errno != E2BIG) {
    198 DEBUG(0,("smb_iconv 2\n"));
    199 return -1;}
     222                    && errno != E2BIG)
     223                        return -1;
    200224
    201225                bufp = cvtbuf;
     
    204228                if (cd->push(cd->cd_push,
    205229                             (const char **)&bufp, &bufsize,
    206                              outbuf, outbytesleft) == -1) {
    207 DEBUG(0,("smb_iconv 3\n"));
    208 return -1;}
     230                             outbuf, outbytesleft) == -1)
     231                                return -1;
    209232        }
    210233
Note: See TracChangeset for help on using the changeset viewer.