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

divers fix for Ticket #68 in 3.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.