Changeset 337 for branches/samba-3.0
- Timestamp:
- Oct 8, 2009, 8:01:00 AM (16 years ago)
- Location:
- branches/samba-3.0/source/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/lib/charcnv.c
r236 r337 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 } … … 397 391 return 0; 398 392 399 // DEBUG(10, ("convert_string: 1"));400 401 393 if (from != CH_UTF16LE && from != CH_UTF16BE && to != CH_UTF16LE && to != CH_UTF16BE) { 402 394 const unsigned char *p = (const unsigned char *)src; … … 406 398 unsigned char lastp = '\0'; 407 399 size_t retval = 0; 408 409 // DEBUG(10, ("convert_string: 2"));410 400 411 401 /* If all characters are ascii, fast path here. */ … … 436 426 } 437 427 return retval; 438 // DEBUG(10, ("convert_string: 3"));439 428 440 429 } else if (from == CH_UTF16LE && to != CH_UTF16LE) { … … 462 451 goto general_case; 463 452 #else 464 453 return retval + convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv); 465 454 #endif 466 455 } … … 474 463 } 475 464 return retval; 476 // DEBUG(10, ("convert_string: 4"));477 465 478 466 } else if (from != CH_UTF16LE && from != CH_UTF16BE && to == CH_UTF16LE) { … … 517 505 general_case: 518 506 #endif 507 519 508 return convert_string_internal(from, to, src, srclen, dest, destlen, allow_bad_conv); 520 509 } … … 593 582 594 583 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));598 584 599 585 retval = smb_iconv(descriptor, -
branches/samba-3.0/source/lib/iconv.c
r165 r337 129 129 } 130 130 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 134 char * 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 131 145 #ifdef HAVE_NATIVE_ICONV 132 146 /* if there was an error then reset the internal state, … … 139 153 #ifdef __OS2__ 140 154 uint16 *outbuf_uc = ( uint16 * )*outbuf; 155 char *to_name = save_toname(NULL, 1); 141 156 #endif 142 157 … … 153 168 else 154 169 { 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 { 155 175 while(( char * )outbuf_uc < *outbuf ) 156 176 { … … 160 180 161 181 outbuf_uc++; 182 } 162 183 } 163 184 } … … 181 202 size_t bufsize; 182 203 204 #ifdef __OS2__ 205 save_toname(cd->to_name, 0); 206 #endif 207 183 208 /* in many cases we can go direct */ 184 209 if (cd->direct) { … … 195 220 if (cd->pull(cd->cd_pull, 196 221 inbuf, inbytesleft, &bufp, &bufsize) == -1 197 && errno != E2BIG) { 198 DEBUG(0,("smb_iconv 2\n")); 199 return -1;} 222 && errno != E2BIG) 223 return -1; 200 224 201 225 bufp = cvtbuf; … … 204 228 if (cd->push(cd->cd_push, 205 229 (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; 209 232 } 210 233
Note:
See TracChangeset
for help on using the changeset viewer.