Changeset 013e5d32 in mainline for uspace/lib/posix/src/stdio/scanf.c
- Timestamp:
- 2018-03-19T20:35:27Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6d1d143
- Parents:
- 973be387
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/stdio/scanf.c
r973be387 r013e5d32 676 676 if (!assign_supress) { 677 677 if (int_conv_unsigned) { 678 unsigned char *phh; 679 unsigned short *ph; 680 unsigned *pdef; 681 unsigned long *pl; 682 unsigned long long *pll; 683 uintmax_t *pj; 684 size_t *pz; 685 // XXX: What is unsigned counterpart of the ptrdiff_t? 686 size_t *pt; 687 void **pp; 688 678 689 switch (length_mod) { 679 case LMOD_hh: ; /* Label cannot be part of declaration. */680 unsigned char *phh = va_arg(arg, unsigned char *);690 case LMOD_hh: 691 phh = va_arg(arg, unsigned char *); 681 692 *phh = (unsigned char) ures; 682 693 break; 683 case LMOD_h: ;684 unsigned short *ph = va_arg(arg, unsigned short *);694 case LMOD_h: 695 ph = va_arg(arg, unsigned short *); 685 696 *ph = (unsigned short) ures; 686 697 break; 687 case LMOD_NONE: ;688 unsigned *pdef = va_arg(arg, unsigned *);698 case LMOD_NONE: 699 pdef = va_arg(arg, unsigned *); 689 700 *pdef = (unsigned) ures; 690 701 break; 691 case LMOD_l: ;692 unsigned long *pl = va_arg(arg, unsigned long *);702 case LMOD_l: 703 pl = va_arg(arg, unsigned long *); 693 704 *pl = (unsigned long) ures; 694 705 break; 695 case LMOD_ll: ;696 unsigned long long *pll = va_arg(arg, unsigned long long *);706 case LMOD_ll: 707 pll = va_arg(arg, unsigned long long *); 697 708 *pll = (unsigned long long) ures; 698 709 break; 699 case LMOD_j: ;700 uintmax_t *pj = va_arg(arg, uintmax_t *);710 case LMOD_j: 711 pj = va_arg(arg, uintmax_t *); 701 712 *pj = (uintmax_t) ures; 702 713 break; 703 case LMOD_z: ;704 size_t *pz = va_arg(arg, size_t *);714 case LMOD_z: 715 pz = va_arg(arg, size_t *); 705 716 *pz = (size_t) ures; 706 717 break; 707 case LMOD_t: ; 708 // XXX: What is unsigned counterpart of the ptrdiff_t? 709 size_t *pt = va_arg(arg, size_t *); 718 case LMOD_t: 719 pt = va_arg(arg, size_t *); 710 720 *pt = (size_t) ures; 711 721 break; 712 case LMOD_p: ;713 void **pp = va_arg(arg, void **);722 case LMOD_p: 723 pp = va_arg(arg, void **); 714 724 *pp = (void *) (uintptr_t) ures; 715 725 break; … … 718 728 } 719 729 } else { 730 signed char *phh; 731 short *ph; 732 int *pdef; 733 long *pl; 734 long long *pll; 735 intmax_t *pj; 736 ssize_t *pz; 737 ptrdiff_t *pt; 738 720 739 switch (length_mod) { 721 case LMOD_hh: ; /* Label cannot be part of declaration. */722 signed char *phh = va_arg(arg, signed char *);740 case LMOD_hh: 741 phh = va_arg(arg, signed char *); 723 742 *phh = (signed char) sres; 724 743 break; 725 case LMOD_h: ;726 short *ph = va_arg(arg, short *);744 case LMOD_h: 745 ph = va_arg(arg, short *); 727 746 *ph = (short) sres; 728 747 break; 729 case LMOD_NONE: ;730 int *pdef = va_arg(arg, int *);748 case LMOD_NONE: 749 pdef = va_arg(arg, int *); 731 750 *pdef = (int) sres; 732 751 break; 733 case LMOD_l: ;734 long *pl = va_arg(arg, long *);752 case LMOD_l: 753 pl = va_arg(arg, long *); 735 754 *pl = (long) sres; 736 755 break; 737 case LMOD_ll: ;738 long long *pll = va_arg(arg, long long *);756 case LMOD_ll: 757 pll = va_arg(arg, long long *); 739 758 *pll = (long long) sres; 740 759 break; 741 case LMOD_j: ;742 intmax_t *pj = va_arg(arg, intmax_t *);760 case LMOD_j: 761 pj = va_arg(arg, intmax_t *); 743 762 *pj = (intmax_t) sres; 744 763 break; 745 case LMOD_z: ;746 ssize_t *pz = va_arg(arg, ssize_t *);764 case LMOD_z: 765 pz = va_arg(arg, ssize_t *); 747 766 *pz = (ssize_t) sres; 748 767 break; 749 case LMOD_t: ;750 pt rdiff_t *pt= va_arg(arg, ptrdiff_t *);768 case LMOD_t: 769 pt = va_arg(arg, ptrdiff_t *); 751 770 *pt = (ptrdiff_t) sres; 752 771 break; … … 857 876 * into the next output argument. */ 858 877 if (!assign_supress) { 878 float *pf; 879 double *pd; 880 long double *pld; 859 881 switch (length_mod) { 860 case LMOD_NONE: ; /* Label cannot be part of declaration. */861 float *pf = va_arg(arg, float *);882 case LMOD_NONE: 883 pf = va_arg(arg, float *); 862 884 *pf = fres; 863 885 break; 864 case LMOD_l: ;865 double *pd = va_arg(arg, double *);886 case LMOD_l: 887 pd = va_arg(arg, double *); 866 888 *pd = dres; 867 889 break; 868 case LMOD_L: ;869 long double *pld = va_arg(arg, long double *);890 case LMOD_L: 891 pld = va_arg(arg, long double *); 870 892 *pld = ldres; 871 893 break;
Note:
See TracChangeset
for help on using the changeset viewer.