Changeset 1712
- Timestamp:
- Dec 6, 2004, 7:46:13 AM (21 years ago)
- Location:
- trunk/src/emx/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.88
to1.89
r1711 r1712 1352 1352 "___wctype" @1367 1353 1353 "____wctype" @1368 1354 "main" @13691355 "_main" @1370 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_ctype.c
-
Property cvs2svn:cvs-rev
changed from
1.10
to1.11
r1711 r1712 249 249 const __LIBC_LOCALEWCTYPE __libc_GLocaleWCtype = 250 250 { 251 .awcUpper = 252 { 253 251 .awcLower = 252 { 254 253 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 255 254 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, … … 287 286 .awcUpper = 288 287 { 289 290 288 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 291 289 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, … … 466 464 467 465 468 #if 1/* code for regenerating that table - link staticly! */466 #if 0 /* code for regenerating that table - link staticly! */ 469 467 470 468 #include <InnoTekLIBC/locale.h> … … 608 606 609 607 /* Lower */ 610 printf(" .awc Upper =\n"611 " { \n");608 printf(" .awcLower =\n" 609 " {"); 612 610 for (i = 0; i < sizeof(__libc_GLocaleWCtype.awcLower) / sizeof(__libc_GLocaleWCtype.awcLower[0]); i++) 613 611 { … … 623 621 /* Upper */ 624 622 printf(" .awcUpper =\n" 625 " { \n");623 " {"); 626 624 for (i = 0; i < sizeof(__libc_GLocaleWCtype.awcUpper) / sizeof(__libc_GLocaleWCtype.awcUpper[0]); i++) 627 625 { … … 637 635 /* Type */ 638 636 printf(" .aufType =\n" 639 " { \n");637 " {"); 640 638 for (i = 0; i < sizeof(__libc_GLocaleWCtype.aufType) / sizeof(__libc_GLocaleWCtype.aufType[0]); i++) 641 639 { -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/mb_libuni.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1711 r1712 99 99 __wchar_t wc; 100 100 unsigned char uch = *(const unsigned char *)s; 101 #ifndef NO_CONVERSION_TABLES 101 102 if ( !pState->chState 102 103 && (wc = __libc_GLocaleCtype.aucUnicode[uch]) != 0xffff) … … 104 105 if (pwc != NULL) 105 106 *pwc = wc; 106 return !wc; 107 } 107 return wc != 0; 108 } 109 #endif /* !NO_CONVERSION_TABLES */ 108 110 109 111 /* … … 111 113 * and restore the state before we try convert anything. 112 114 */ 113 if (!pwc) 114 pwc = &wc; /* The api crashes elsewise. */ 115 wchar_t *pwcIn = &wc; 116 if (n >= 0x7fffffff) 117 n = 0x7ffffffe; /* UTF-8 decoder/encoder don't like -1, so let's play safe. */ 115 118 size_t cbInLeft = n; 116 119 size_t cwcOutLeft = 1; … … 133 136 if (!rc) 134 137 { 135 rc = UniUconvToUcs(__libc_GLocaleCtype.uobj, (void **)(void *)&s, &cbInLeft, (UniChar **)&pwc, &cwcOutLeft, &cIgnore); 136 if (!rc) 137 { 138 rc = UniUconvToUcs(__libc_GLocaleCtype.uobj, (void **)(void *)&s, &cbInLeft, (UniChar **)&pwcIn, &cwcOutLeft, &cIgnore); 139 if ( !rc 140 || (rc == UCONV_E2BIG && !cwcOutLeft)) 141 { 142 if (pwc) 143 *pwc = wc; 144 rc = 0; 138 145 if (!UniQueryUconvObject(__libc_GLocaleCtype.uobj, &attr, sizeof(attr), NULL, NULL, NULL)) 139 146 pState->chState = attr.state; … … 145 152 146 153 if (!rc) 147 return n - cbInLeft ;154 return n - cbInLeft - !wc; 148 155 /* failure */ 149 156 libuni_errno(rc); … … 170 177 */ 171 178 char ch; 179 #ifndef NO_CONVERSION_TABLES 172 180 if (!pState->chState) 173 181 { … … 204 212 /* not found */ 205 213 } 214 #endif /* !NO_CONVERSION_TABLES */ 206 215 207 216 /* … … 279 288 { 280 289 const char *pch = *src; 281 size_t c wc = 0;290 size_t cbIn = nms; 282 291 if (dst == NULL) 283 292 { … … 291 300 return (size_t)-1; /* Invalid sequence - mbrtowc() sets errno. */ 292 301 else /* if (cb == 0 || cb == (size_t)-2) */ 293 return c wc;302 return cbIn - nms; 294 303 } 295 304 … … 297 306 pch += cb; 298 307 nms -= cb; 299 cwc++;300 308 } 301 309 /* (won't ever get here.) */ … … 311 319 { 312 320 *src = NULL; 313 return c wc;321 return cbIn - nms; 314 322 } 315 323 else if (cb == (size_t)-2) 316 324 { 317 325 *src = pch + nms; 318 return c wc;326 return cbIn - nms; 319 327 } 320 328 else /*if (cb == (size_t)-1) */ … … 328 336 pch += cb; 329 337 nms -= cb; 330 cwc++;331 338 dst++; 332 339 } 333 340 334 341 *src = pch; 335 return c wc;342 return cbIn - nms; 336 343 } 337 344 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/setlocale.c
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r1711 r1712 206 206 static const char *getDefaultLocale(const char *pszCategory, char *pszBuffer, int *pfDefault); 207 207 static int getCodepage(const char *pszCodepage, const char *pszLocale, LocaleObject lobj, UniChar *pucsCodepage, unsigned cucCodepage); 208 static int query_mbcs(UconvObject uobj, char *mbcs, unsigned char *au2MBCSPrefixs , int *pmb_cur_max);208 static int query_mbcs(UconvObject uobj, char *mbcs, unsigned char *au2MBCSPrefixs); 209 209 210 210 static int localeCollateDo(__LIBC_PLOCALECOLLATE pCollate, UconvObject uobj, LocaleObject lobj); … … 336 336 337 337 338 static int query_mbcs(UconvObject uobj, char *mbcs, unsigned char *au2MBCSPrefixs , int *pmb_cur_max)338 static int query_mbcs(UconvObject uobj, char *mbcs, unsigned char *au2MBCSPrefixs) 339 339 { 340 340 unsigned i; … … 353 353 * Create the return values. 354 354 */ 355 if (pmb_cur_max) 356 *pmb_cur_max = uconv_attr.mb_max_len; 357 *mbcs = (uconv_attr.mb_max_len > 1); 355 *mbcs = uconv_attr.mb_max_len > 1 ? uconv_attr.mb_max_len : 0; 358 356 359 357 bzero(au2MBCSPrefixs, 256/4); … … 384 382 * Query multi-byte related stuff. 385 383 */ 386 rc = query_mbcs(uobj, &pCollate->mbcs, &pCollate->au2MBCSPrefixs[0] , NULL);384 rc = query_mbcs(uobj, &pCollate->mbcs, &pCollate->au2MBCSPrefixs[0]); 387 385 if (rc) 388 386 return rc; … … 508 506 * Query multi-byte related stuff. 509 507 */ 510 rc = query_mbcs(uobj, &pCtype->mbcs, &pCtype->au2MBCSPrefixs[0] , NULL);508 rc = query_mbcs(uobj, &pCtype->mbcs, &pCtype->au2MBCSPrefixs[0]); 511 509 if (rc) 512 510 return rc; … … 1446 1444 localeCtypeFree(&__libc_GLocaleCtype); 1447 1445 memcpy(&__libc_GLocaleCtype, &pTemp->Ctype, sizeof(__libc_GLocaleCtype)); 1446 MB_CUR_MAX = pTemp->Ctype.mbcs ? pTemp->Ctype.mbcs : 1; 1448 1447 pTemp->afProcessed[LC_CTYPE + 1] = 0; 1449 1448 gLocale.apszNames[LC_CTYPE + 1] = pTemp->Global.apszNames[LC_CTYPE + 1]; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.