Ignore:
Timestamp:
Jun 4, 2010, 3:11:43 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: merged changes from 3.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/lib/iconv.c

    r414 r454  
    128128}
    129129
     130#ifdef __OS2__
     131// i could have done a static variable w/o this function. but i feel it's nicer this way.
     132// the purpose of this function is to save the to_name to get the korean and japanese code set working
     133char * save_toname(char *toname, bool what)
     134{
     135   static char *to_name=NULL;
     136
     137   if ( what == 0 )
     138        to_name = SMB_STRDUP(toname);
     139
     140        return to_name;
     141}
     142#endif
     143
    130144#ifdef HAVE_NATIVE_ICONV
    131145/* if there was an error then reset the internal state,
     
    136150                        char **outbuf, size_t *outbytesleft)
    137151{
     152#ifdef __OS2__
     153        uint16 *outbuf_uc = ( uint16 * )*outbuf;
     154        char *to_name = save_toname(NULL, 1);
     155#endif
     156
    138157        size_t ret = iconv((iconv_t)cd,
    139158                           (void *)inbuf, inbytesleft,
     
    144163                errno = saved_errno;
    145164        }
     165#ifdef __OS2__
     166        /* Workaround for path separator on OS/2 */
     167        else
     168        {
     169                if( (strstr(to_name, "949") != NULL) ||     /* Korean CP */
     170                   (strstr(to_name, "932") != NULL) ||      /* Japanese CP */
     171                   (strstr(to_name, "942") != NULL) ||      /* Japanese CP */
     172                   (strstr(to_name, "943") != NULL) )       /* Japanese CP */
     173                {
     174                         while(( char * )outbuf_uc < *outbuf )
     175                        {
     176                            if( *outbuf_uc == 0x20a9 ||     /* Korean WON */
     177                                *outbuf_uc == 0x00a5 )      /* Japanese YEN */
     178                                *outbuf_uc = '\\';
     179
     180                            outbuf_uc++;
     181                        }
     182                }
     183        }
     184#endif
     185
    146186        return ret;
    147187}
     
    161201        char *bufp = cvtbuf;
    162202        size_t bufsize;
     203#ifdef __OS2__
     204        save_toname(cd->to_name, 0);
     205#endif
    163206
    164207        /* in many cases we can go direct */
Note: See TracChangeset for help on using the changeset viewer.