Changeset 7f1c620 in mainline for generic/src/printf/printf_core.c


Ignore:
Timestamp:
2006-07-04T17:17:56Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0ffa3ef5
Parents:
991779c5
Message:

Replace old u?? types with respective C99 variants (e.g. uint32_t, int64_t, uintptr_t etc.).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/printf/printf_core.c

    r991779c5 r7f1c620  
    8989 * @return string length without trailing zero.
    9090 */
    91 static __native strlen(const char *str)
    92 {
    93         __native counter = 0;
     91static unative_t strlen(const char *str)
     92{
     93        unative_t counter = 0;
    9494
    9595        while (str[counter] != 0) {
     
    147147 * @return number of printed characters, negative value on fail
    148148 */
    149 static int print_char(char c, int width, __u64 flags, struct printf_spec *ps)
     149static int print_char(char c, int width, uint64_t flags, struct printf_spec *ps)
    150150{
    151151        int counter = 0;
     
    177177 */
    178178                                               
    179 static int print_string(char *s, int width, int precision, __u64 flags, struct printf_spec *ps)
     179static int print_string(char *s, int width, int precision, uint64_t flags, struct printf_spec *ps)
    180180{
    181181        int counter = 0;
     
    237237 *
    238238 */
    239 static int print_number(__u64 num, int width, int precision, int base , __u64 flags, struct printf_spec *ps)
     239static int print_number(uint64_t num, int width, int precision, int base , uint64_t flags, struct printf_spec *ps)
    240240{
    241241        char *digits = digits_small;
     
    428428 *      - "l"   Signed or usigned long int.@n
    429429 *      - "ll"  Signed or usigned long long int.@n
    430  *      - "z"   __native (non-standard extension).@n
     430 *      - "z"   unative_t (non-standard extension).@n
    431431 *
    432432 *
     
    467467        qualifier_t qualifier;  /* type of argument */
    468468        int base;       /**< base in which will be parameter (numbers only) printed */
    469         __u64 number; /**< argument value */
     469        uint64_t number; /**< argument value */
    470470        size_t  size; /**< byte size of integer parameter */
    471471        int width, precision;
    472         __u64 flags;
     472        uint64_t flags;
    473473       
    474474        counter = 0;
     
    563563                                        }
    564564                                        break;
    565                                 case 'z':       /* __native */
     565                                case 'z':       /* unative_t */
    566566                                        qualifier = PrintfQualifierNative;
    567567                                        break;
     
    645645                                case PrintfQualifierByte:
    646646                                        size = sizeof(unsigned char);
    647                                         number = (__u64)va_arg(ap, unsigned int);
     647                                        number = (uint64_t)va_arg(ap, unsigned int);
    648648                                        break;
    649649                                case PrintfQualifierShort:
    650650                                        size = sizeof(unsigned short);
    651                                         number = (__u64)va_arg(ap, unsigned int);
     651                                        number = (uint64_t)va_arg(ap, unsigned int);
    652652                                        break;
    653653                                case PrintfQualifierInt:
    654654                                        size = sizeof(unsigned int);
    655                                         number = (__u64)va_arg(ap, unsigned int);
     655                                        number = (uint64_t)va_arg(ap, unsigned int);
    656656                                        break;
    657657                                case PrintfQualifierLong:
    658658                                        size = sizeof(unsigned long);
    659                                         number = (__u64)va_arg(ap, unsigned long);
     659                                        number = (uint64_t)va_arg(ap, unsigned long);
    660660                                        break;
    661661                                case PrintfQualifierLongLong:
    662662                                        size = sizeof(unsigned long long);
    663                                         number = (__u64)va_arg(ap, unsigned long long);
     663                                        number = (uint64_t)va_arg(ap, unsigned long long);
    664664                                        break;
    665665                                case PrintfQualifierPointer:
    666666                                        size = sizeof(void *);
    667                                         number = (__u64)(unsigned long)va_arg(ap, void *);
     667                                        number = (uint64_t)(unsigned long)va_arg(ap, void *);
    668668                                        break;
    669669                                case PrintfQualifierNative:
    670                                         size = sizeof(__native);
    671                                         number = (__u64)va_arg(ap, __native);
     670                                        size = sizeof(unative_t);
     671                                        number = (uint64_t)va_arg(ap, unative_t);
    672672                                        break;
    673673                                default: /* Unknown qualifier */
     
    680680                                        flags |= __PRINTF_FLAG_NEGATIVE;
    681681                               
    682                                         if (size == sizeof(__u64)) {
    683                                                 number = -((__s64)number);
     682                                        if (size == sizeof(uint64_t)) {
     683                                                number = -((int64_t)number);
    684684                                        } else {
    685685                                                number = ~number;
     
    704704       
    705705        if (i > j) {
    706                 if ((retval = printf_putnchars(&fmt[j], (__native)(i - j), ps)) < 0) { /* error */
     706                if ((retval = printf_putnchars(&fmt[j], (unative_t)(i - j), ps)) < 0) { /* error */
    707707                        counter = -counter;
    708708                        goto out;
Note: See TracChangeset for help on using the changeset viewer.