Rev 4199 | Rev 4205 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4199 | Rev 4200 | ||
---|---|---|---|
Line 592... | Line 592... | ||
592 | count_t counter = 0; /* Number of UTF-8 characters printed */ |
592 | count_t counter = 0; /* Number of UTF-8 characters printed */ |
593 | int retval; /* Return values from nested functions */ |
593 | int retval; /* Return values from nested functions */ |
594 | 594 | ||
595 | while (true) { |
595 | while (true) { |
596 | i = nxt; |
596 | i = nxt; |
597 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
597 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
598 | 598 | ||
599 | if (uc == '\0') break; |
599 | if (uc == '\0') break; |
600 | 600 | ||
601 | /* Control character */ |
601 | /* Control character */ |
602 | if (uc == '%') { |
602 | if (uc == '%') { |
Line 616... | Line 616... | ||
616 | uint32_t flags = 0; |
616 | uint32_t flags = 0; |
617 | bool end = false; |
617 | bool end = false; |
618 | 618 | ||
619 | do { |
619 | do { |
620 | i = nxt; |
620 | i = nxt; |
621 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
621 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
622 | switch (uc) { |
622 | switch (uc) { |
623 | case '#': |
623 | case '#': |
624 | flags |= __PRINTF_FLAG_PREFIX; |
624 | flags |= __PRINTF_FLAG_PREFIX; |
625 | break; |
625 | break; |
626 | case '-': |
626 | case '-': |
Line 646... | Line 646... | ||
646 | while (true) { |
646 | while (true) { |
647 | width *= 10; |
647 | width *= 10; |
648 | width += uc - '0'; |
648 | width += uc - '0'; |
649 | 649 | ||
650 | i = nxt; |
650 | i = nxt; |
651 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
651 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
652 | if (uc == '\0') |
652 | if (uc == '\0') |
653 | break; |
653 | break; |
654 | if (!isdigit(uc)) |
654 | if (!isdigit(uc)) |
655 | break; |
655 | break; |
656 | } |
656 | } |
657 | } else if (uc == '*') { |
657 | } else if (uc == '*') { |
658 | /* Get width value from argument list */ |
658 | /* Get width value from argument list */ |
659 | i = nxt; |
659 | i = nxt; |
660 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
660 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
661 | width = (int) va_arg(ap, int); |
661 | width = (int) va_arg(ap, int); |
662 | if (width < 0) { |
662 | if (width < 0) { |
663 | /* Negative width sets '-' flag */ |
663 | /* Negative width sets '-' flag */ |
664 | width *= -1; |
664 | width *= -1; |
665 | flags |= __PRINTF_FLAG_LEFTALIGNED; |
665 | flags |= __PRINTF_FLAG_LEFTALIGNED; |
Line 668... | Line 668... | ||
668 | 668 | ||
669 | /* Precision and '*' operator */ |
669 | /* Precision and '*' operator */ |
670 | int precision = 0; |
670 | int precision = 0; |
671 | if (uc == '.') { |
671 | if (uc == '.') { |
672 | i = nxt; |
672 | i = nxt; |
673 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
673 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
674 | if (isdigit(uc)) { |
674 | if (isdigit(uc)) { |
675 | while (true) { |
675 | while (true) { |
676 | precision *= 10; |
676 | precision *= 10; |
677 | precision += uc - '0'; |
677 | precision += uc - '0'; |
678 | 678 | ||
679 | i = nxt; |
679 | i = nxt; |
680 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
680 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
681 | if (uc == '\0') |
681 | if (uc == '\0') |
682 | break; |
682 | break; |
683 | if (!isdigit(uc)) |
683 | if (!isdigit(uc)) |
684 | break; |
684 | break; |
685 | } |
685 | } |
686 | } else if (uc == '*') { |
686 | } else if (uc == '*') { |
687 | /* Get precision value from the argument list */ |
687 | /* Get precision value from the argument list */ |
688 | i = nxt; |
688 | i = nxt; |
689 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
689 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
690 | precision = (int) va_arg(ap, int); |
690 | precision = (int) va_arg(ap, int); |
691 | if (precision < 0) { |
691 | if (precision < 0) { |
692 | /* Ignore negative precision */ |
692 | /* Ignore negative precision */ |
693 | precision = 0; |
693 | precision = 0; |
694 | } |
694 | } |
Line 703... | Line 703... | ||
703 | */ |
703 | */ |
704 | case 'h': |
704 | case 'h': |
705 | /* Char or short */ |
705 | /* Char or short */ |
706 | qualifier = PrintfQualifierShort; |
706 | qualifier = PrintfQualifierShort; |
707 | i = nxt; |
707 | i = nxt; |
708 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
708 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
709 | if (uc == 'h') { |
709 | if (uc == 'h') { |
710 | i = nxt; |
710 | i = nxt; |
711 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
711 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
712 | qualifier = PrintfQualifierByte; |
712 | qualifier = PrintfQualifierByte; |
713 | } |
713 | } |
714 | break; |
714 | break; |
715 | case 'l': |
715 | case 'l': |
716 | /* Long or long long */ |
716 | /* Long or long long */ |
717 | qualifier = PrintfQualifierLong; |
717 | qualifier = PrintfQualifierLong; |
718 | i = nxt; |
718 | i = nxt; |
719 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
719 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
720 | if (uc == 'l') { |
720 | if (uc == 'l') { |
721 | i = nxt; |
721 | i = nxt; |
722 | uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT); |
722 | uc = chr_decode(fmt, &nxt, UTF8_NO_LIMIT); |
723 | qualifier = PrintfQualifierLongLong; |
723 | qualifier = PrintfQualifierLongLong; |
724 | } |
724 | } |
725 | break; |
725 | break; |
726 | default: |
726 | default: |
727 | /* Default type */ |
727 | /* Default type */ |