Changeset 2792 for branches/libc-0.6/src
- Timestamp:
- Aug 27, 2006, 8:31:48 PM (19 years ago)
- Location:
- branches/libc-0.6/src/emx
- Files:
-
- 3 edited
-
ChangeLog.LIBC (modified) (1 diff)
-
src/lib/io/_input.c (modified) (11 diffs)
-
src/lib/io/_output.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/ChangeLog.LIBC
r2786 r2792 5 5 2006-08-27: knut st. osmundsen <[email protected]> 6 6 - libc: 7 8 7 9 o Fixed problems with fork() and module loading/unloading. Fixes #76. 8 10 o Fixed atexit() and on_exit() problem with callbacks in unloaded DLLs. Fixes #103. -
branches/libc-0.6/src/emx/src/lib/io/_input.c
r2090 r2792 4 4 #include <stdio.h> 5 5 #include <stdlib.h> 6 6 7 #include <stdarg.h> 7 8 #include <string.h> … … 16 17 #define TRUE 1 17 18 19 20 21 22 18 23 /* This structure holds the local variables of _input() which are 19 24 passed to the functions called by _input(). */ … … 28 33 int collected; /* Number of characters collected */ 29 34 size_t more_size; /* Size of the above */ 30 char size; /* Size (0, 'h', 'l' or 'L') */35 ') */ 31 36 char width_given; /* A field width has been given */ 32 37 unsigned char ungetc_count; /* stream's _ungetc_count prior to get0() */ … … 192 197 193 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 194 227 static void inp_str (ilocal *v, unsigned char *dst) 195 228 { … … 197 230 198 231 c = skip (v); 199 if (v->status != OK) return; 232 if (v->status != OK) 233 return; 200 234 while (c != EOF && !isspace (c)) 201 235 { … … 211 245 make_unread (v, c); 212 246 } 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 213 274 214 275 … … 372 433 switch (v->size) 373 434 { 374 case 'L':375 *(long long *)dst = n;376 break;377 435 case 'h': 378 436 *(short *)dst = n; 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 379 458 break; 380 459 default: … … 659 738 v->width_given = TRUE; 660 739 } 661 if (*format == 'h' || *format == 'l' || *format == 'L') 662 v->size = *format++; 740 if ( *format == 'h' || *format == 'l' || *format == 'L' 741 || *format == 'j' || *format == 'z' || *format == 't' 742 || *format == 'q' || *format == 'Z' ) 743 { 744 v->size = *format++; 745 if (v->size == 'l' && *format == 'l') 746 { 747 v->size = SIZE_LL; ++format; 748 } 749 else if (v->size == 'h' && *format == 'h') 750 { 751 v->size = SIZE_HH; ++format; 752 } 753 } 663 754 f = *format; 664 755 switch (f) 665 756 { 666 case 'c':667 if (assign)668 dst = va_arg (arg_ptr, char *);669 inp_char (v, dst);670 break;671 672 757 case '[': 673 758 if (assign) … … 676 761 break; 677 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 678 778 case 's': 679 if (assign) 680 dst = va_arg (arg_ptr, char *); 681 inp_str (v, dst); 682 break; 779 if (v->size != 'l' && v->size == 'L') 780 { 781 if (assign) 782 dst = va_arg (arg_ptr, char *); 783 inp_str (v, dst); 784 break; 785 } 786 /* fall thru */ 787 case 'S': 788 if (assign) 789 dst = va_arg (arg_ptr, wchar_t *); 790 inp_wstr (v, dst); 791 break; 683 792 684 793 case 'f': … … 713 822 switch (v->size) 714 823 { 715 case 'L':716 dst = va_arg (arg_ptr, long long*);824 case : 825 dst = va_arg (arg_ptr, *); 717 826 break; 718 827 case 'h': 719 828 dst = va_arg (arg_ptr, short *); 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 720 847 break; 721 848 default: … … 730 857 switch (v->size) 731 858 { 732 case 'L':733 *(va_arg (arg_ptr, long long*)) = v->chars;859 case : 860 *(va_arg (arg_ptr, *)) = v->chars; 734 861 break; 735 862 case 'h': 736 863 *(va_arg (arg_ptr, short *)) = v->chars; 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 737 879 break; 738 880 default: -
branches/libc-0.6/src/emx/src/lib/io/_output.c
r2160 r2792 5 5 #include <stdlib.h> 6 6 #include <stdarg.h> 7 7 8 #include <string.h> 8 9 #include <math.h> … … 21 22 #define SIZE_HH (('h' << 8) | 'h') 22 23 #define SIZE_LL (('l' << 8) | 'l') 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 23 72 24 73 #define DEFAULT_PREC 6 … … 369 418 370 419 371 static int cvt_hex_32 (olocal *v, u nsignedn, char x)420 static int cvt_hex_32 (olocal *v, u n, char x) 372 421 { 373 422 char buf[9]; … … 378 427 379 428 380 static int cvt_hex_64 (olocal *v, u nsigned long longn, char x)429 static int cvt_hex_64 (olocal *v, u n, char x) 381 430 { 382 431 char buf[17]; … … 401 450 402 451 403 static int cvt_oct_32 (olocal *v, u nsignedn)452 static int cvt_oct_32 (olocal *v, u n) 404 453 { 405 454 char buf[12]; … … 410 459 411 460 412 static int cvt_oct_64 (olocal *v, u nsigned long longn)461 static int cvt_oct_64 (olocal *v, u n) 413 462 { 414 463 char buf[23]; … … 419 468 420 469 421 static int cvt_dec_32 (olocal *v, u nsignedn, int is_signed, int is_neg)470 static int cvt_dec_32 (olocal *v, u n, int is_signed, int is_neg) 422 471 { 423 472 char buf[11]; … … 428 477 429 478 430 static int cvt_dec_64 (olocal *v, unsigned long long n, int is_signed, 431 int is_neg) 479 static int cvt_dec_64 (olocal *v, uint64_t n, int is_signed, int is_neg) 432 480 { 433 481 char buf[21]; … … 905 953 size = SIZE_HH; ++format; 906 954 } 907 else if (size == 'q' || size == 'j')908 size = SIZE_LL;909 else if (size == 'z' || size == 'Z' || size == 't')910 size = 'l';911 955 } 912 956 … … 919 963 920 964 case 'n': 921 if ( size == SIZE_LL || size == 'L')922 { 923 long long *ptr = va_arg (arg_ptr, long long*);965 if () 966 { 967 *); 924 968 *ptr = v.count; 925 969 } 926 else if ( size == 'h')927 { 928 short *ptr = va_arg (arg_ptr, short *);970 else if () 971 { 972 t *); 929 973 *ptr = v.count; 930 974 } 931 else if ( size == SIZE_HH)932 { 933 char *ptr = va_arg (arg_ptr, char*);975 else if () 976 { 977 *); 934 978 *ptr = v.count; 935 979 } 936 else 937 { 938 int *ptr = va_arg (arg_ptr, int *);980 else 981 { 982 intt *); 939 983 *ptr = v.count; 940 984 } … … 975 1019 case 'd': 976 1020 case 'i': 977 if ( size == SIZE_LL || size == 'L')978 { 979 long long n = va_arg (arg_ptr, long long);1021 if () 1022 { 1023 ); 980 1024 if (n < 0) 981 1025 CHECK (cvt_dec_64 (&v, -n, TRUE, TRUE)); … … 985 1029 else 986 1030 { 987 int n = va_arg (arg_ptr, int);1031 intt); 988 1032 if (size == 'h') 989 1033 n = (short)n; … … 998 1042 999 1043 case 'u': 1000 if (size == SIZE_LL || size == 'L') 1001 CHECK (cvt_dec_64 (&v, va_arg (arg_ptr, unsigned long long), 1002 FALSE, FALSE)); 1044 if (IS_SIZE_64BIT (size)) 1045 CHECK (cvt_dec_64 (&v, va_arg (arg_ptr, uint64_t), FALSE, FALSE)); 1003 1046 else 1004 1047 { 1005 u nsigned n = va_arg (arg_ptr, unsigned);1048 u); 1006 1049 if (size == 'h') 1007 1050 n = (unsigned short)n; … … 1014 1057 case 'p': 1015 1058 v.hash = TRUE; 1016 CHECK (cvt_hex_32 (&v, va_arg (arg_ptr, unsigned), 'x')); 1059 if (sizeof(uintptr_t) == sizeof(uint64_t)) 1060 CHECK (cvt_hex_64 (&v, va_arg (arg_ptr, uintptr_t), 'x')); 1061 else 1062 CHECK (cvt_hex_32 (&v, va_arg (arg_ptr, uintptr_t), 'x')); 1017 1063 break; 1018 1064 1019 1065 case 'x': 1020 1066 case 'X': 1021 if ( size == SIZE_LL || size == 'L')1022 CHECK (cvt_hex_64 (&v, va_arg (arg_ptr, u nsigned long long),1067 if () 1068 CHECK (cvt_hex_64 (&v, va_arg (arg_ptr, u), 1023 1069 *format)); 1024 1070 else 1025 1071 { 1026 u nsigned n = va_arg (arg_ptr, unsigned);1072 u); 1027 1073 if (size == 'h') 1028 1074 n = (unsigned short)n; … … 1034 1080 1035 1081 case 'o': 1036 if ( size == SIZE_LL || size == 'L')1037 CHECK (cvt_oct_64 (&v, va_arg (arg_ptr, u nsigned long long)));1082 if () 1083 CHECK (cvt_oct_64 (&v, va_arg (arg_ptr, u))); 1038 1084 else 1039 1085 { 1040 u nsigned n = va_arg (arg_ptr, unsigned);1086 u); 1041 1087 if (size == 'h') 1042 1088 n = (unsigned short)n;
Note:
See TracChangeset
for help on using the changeset viewer.
