Changeset 339
- Timestamp:
- Oct 8, 2009, 8:11:59 AM (16 years ago)
- Location:
- branches/samba-3.3.x/source/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/lib/charcnv.c
r239 r339 56 56 { 57 57 const char *ret = NULL; 58 #ifndef __OS2__59 58 if (ch == CH_UTF16LE) ret = "UTF-16LE"; 60 59 else if (ch == CH_UTF16BE) ret = "UTF-16BE"; 61 #else62 if (ch == CH_UTF16LE) ret = "IBM-1200";63 else if (ch == CH_UTF16BE) ret = "IBM-1200";64 #endif65 60 else if (ch == CH_UNIX) ret = lp_unix_charset(); 66 61 else if (ch == CH_DOS) ret = lp_dos_charset(); … … 93 88 94 89 if (!ret || !*ret) ret = "ASCII"; 95 DEBUG(10, ("codepage: %s\n",ret));96 90 return ret; 97 91 } … … 396 390 return 0; 397 391 398 // DEBUG(10, ("convert_string: 1"));399 400 392 if (from != CH_UTF16LE && from != CH_UTF16BE && to != CH_UTF16LE && to != CH_UTF16BE) { 401 393 const unsigned char *p = (const unsigned char *)src; … … 405 397 unsigned char lastp = '\0'; 406 398 size_t retval = 0; 407 408 // DEBUG(10, ("convert_string: 2"));409 399 410 400 /* If all characters are ascii, fast path here. */ … … 439 429 } 440 430 return retval; 441 // DEBUG(10, ("convert_string: 3"));442 431 443 432 } else if (from == CH_UTF16LE && to != CH_UTF16LE) { … … 481 470 } 482 471 return retval; 483 // DEBUG(10, ("convert_string: 4"));484 472 485 473 } else if (from != CH_UTF16LE && from != CH_UTF16BE && to == CH_UTF16LE) { … … 627 615 628 616 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 632 618 633 619 retval = smb_iconv(descriptor, -
branches/samba-3.3.x/source/lib/iconv.c
r206 r339 128 128 } 129 129 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 133 char * 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 130 144 #ifdef HAVE_NATIVE_ICONV 131 145 /* if there was an error then reset the internal state, … … 138 152 #ifdef __OS2__ 139 153 uint16 *outbuf_uc = ( uint16 * )*outbuf; 154 char *to_name = save_toname(NULL, 1); 140 155 #endif 141 156 … … 152 167 else 153 168 { 154 while(( char * )outbuf_uc < *outbuf ) 155 { 156 if( *outbuf_uc == 0x20a9 || /* Korean WON */ 157 *outbuf_uc == 0x00a5 ) /* Japanese YEN */ 158 *outbuf_uc = '\\'; 159 160 outbuf_uc++; 161 } 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 } 162 183 } 163 184 #endif … … 180 201 size_t bufsize; 181 202 203 #ifdef __OS2__ 204 save_toname(cd->to_name, 0); 205 #endif 206 182 207 /* in many cases we can go direct */ 183 208 if (cd->direct) { … … 194 219 if (cd->pull(cd->cd_pull, 195 220 inbuf, inbytesleft, &bufp, &bufsize) == -1 196 && errno != E2BIG) { 197 DEBUG(0,("smb_iconv 2\n")); 198 return -1;} 221 && errno != E2BIG) 222 return -1; 199 223 200 224 bufp = cvtbuf; … … 203 227 if (cd->push(cd->cd_push, 204 228 (const char **)&bufp, &bufsize, 205 outbuf, outbytesleft) == -1) { 206 DEBUG(0,("smb_iconv 3\n")); 207 return -1;} 229 outbuf, outbytesleft) == -1) 230 return -1; 208 231 } 209 232
Note:
See TracChangeset
for help on using the changeset viewer.