Changeset 341


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

divers fix for Ticket #68 in 3.2

Location:
branches/samba-3.2.x/source/lib
Files:
2 edited

Legend:

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

    r237 r341  
    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}
     
    396390                return 0;
    397391
    398 //      DEBUG(10, ("convert_string: 1"));
    399 
    400392        if (from != CH_UTF16LE && from != CH_UTF16BE && to != CH_UTF16LE && to != CH_UTF16BE) {
    401393                const unsigned char *p = (const unsigned char *)src;
     
    405397                unsigned char lastp = '\0';
    406398                size_t retval = 0;
    407 
    408 //      DEBUG(10, ("convert_string: 2"));
    409399
    410400                /* If all characters are ascii, fast path here. */
     
    439429                }
    440430                return retval;
    441 //              DEBUG(10, ("convert_string: 3"));
    442431
    443432        } else if (from == CH_UTF16LE && to != CH_UTF16LE) {
     
    481470                }
    482471                return retval;
    483 //              DEBUG(10, ("convert_string: 4"));
    484472
    485473        } else if (from != CH_UTF16LE && from != CH_UTF16BE && to == CH_UTF16LE) {
     
    627615
    628616 again:
    629         DEBUG(10,("convert_string_internal: convert_string(%s,%s): srclen=%u destlen=%u\n",
    630         charset_name(from), charset_name(to),
    631         (unsigned int)srclen, (unsigned int)destlen));
     617       
    632618
    633619        retval = smb_iconv(descriptor,
  • branches/samba-3.2.x/source/lib/iconv.c

    r133 r341  
    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. SCS
     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,
     
    138152#ifdef __OS2__
    139153        uint16 *outbuf_uc = ( uint16 * )*outbuf;
     154        char *to_name = save_toname(NULL, 1);
    140155#endif
    141156        size_t ret = iconv((iconv_t)cd,
     
    151166        else
    152167        {
    153         while(( char * )outbuf_uc < *outbuf )
    154         {
    155             if( *outbuf_uc == 0x20a9 ||     /* Korean WON */
    156                 *outbuf_uc == 0x00a5 )      /* Japanese YEN */
    157                 *outbuf_uc = '\\';
    158 
    159             outbuf_uc++;
    160         }
     168                if( (strstr(to_name, "949") != NULL) ||     /* Korean CP */
     169                   (strstr(to_name, "932") != NULL) ||      /* Japanese CP */
     170                   (strstr(to_name, "942") != NULL) ||      /* Japanese CP */
     171                   (strstr(to_name, "943") != NULL) )       /* Japanese CP */
     172                {
     173                         while(( char * )outbuf_uc < *outbuf )
     174                        {
     175                            if( *outbuf_uc == 0x20a9 ||     /* Korean WON */
     176                                *outbuf_uc == 0x00a5 )      /* Japanese YEN */
     177                                *outbuf_uc = '\\';
     178
     179                            outbuf_uc++;
     180                        }
     181                }
    161182        }
    162183#endif
     
    179200        size_t bufsize;
    180201
     202#ifdef __OS2__
     203        save_toname(cd->to_name, 0);
     204#endif
     205
    181206        /* in many cases we can go direct */
    182207        if (cd->direct) {
Note: See TracChangeset for help on using the changeset viewer.