Changeset 1052
- Timestamp:
- Jan 25, 2018, 11:51:10 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/lib/util/charset/codepoints.c
r745 r1052 169 169 if (global_iconv_convenience == NULL) 170 170 global_iconv_convenience = smb_iconv_convenience_reinit(talloc_autofree_context(), 171 #ifdef __OS2__ 172 lp_dos_charset(), lp_unix_charset(), lp_display_charset(), true, NULL); 173 #else 171 174 "ASCII", "UTF-8", "ASCII", true, NULL); 175 #endif 172 176 return global_iconv_convenience; 173 177 } … … 354 358 smb_iconv_t descriptor; 355 359 size_t ilen_orig; 360 #ifdef __OS2__ 361 size_t ilen_max; 362 size_t olen_orig; 363 const char *inbuf; 364 #endif 356 365 size_t ilen; 357 366 size_t olen; … … 368 377 */ 369 378 ilen_orig = strnlen(str, 5); 379 #ifdef __OS2__ 380 ilen_max = strnlen(str, 5); 381 *bytes_consumed = 1; 382 #endif 370 383 ilen = ilen_orig; 371 384 … … 376 389 } 377 390 391 #ifdef __OS2__ 392 ilen_orig = 1; 393 olen_orig = 2; 394 while( 1 ) 395 { 396 ilen = ilen_orig; 397 olen = olen_orig; 398 inbuf = str; 399 outbuf = ( char * )buf; 400 if( smb_iconv( descriptor, &inbuf, &ilen, &outbuf, &olen ) != ( size_t )-1 ) 401 break; 402 403 switch( errno ) 404 { 405 case E2BIG : 406 if( olen_orig == 2 ) 407 olen_orig = 4; 408 else 409 return INVALID_CODEPOINT; 410 break; 411 412 413 case EINVAL : 414 if( ilen_orig < ilen_max ) 415 ilen_orig++; 416 else 417 return INVALID_CODEPOINT; 418 break; 419 420 case EILSEQ : 421 default : 422 return INVALID_CODEPOINT; 423 } 424 } 425 olen = olen_orig - olen; 426 #else 378 427 /* 379 428 * this looks a little strange, but it is needed to cope with … … 396 445 olen = 2 - olen; 397 446 } 447 #endif 398 448 399 449 *bytes_consumed = ilen_orig - ilen;
Note:
See TracChangeset
for help on using the changeset viewer.