Ignore:
Timestamp:
2010-05-04T11:07:11Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ae4235c
Parents:
4940ea9
Message:

unify printf implementations

File:
1 edited

Legend:

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

    r4940ea9 r2afb650  
    261261        if (str == NULL)
    262262                return printf_putstr(nullstr, ps);
    263 
     263       
    264264        /* Print leading spaces. */
    265265        size_t strw = str_length(str);
    266266        if (precision == 0)
    267267                precision = strw;
    268 
     268       
    269269        /* Left padding */
    270270        size_t counter = 0;
     
    276276                }
    277277        }
    278 
     278       
    279279        /* Part of @a str fitting into the alloted space. */
    280280        int retval;
     
    391391         */
    392392        if (flags & __PRINTF_FLAG_PREFIX) {
    393                 switch(base) {
     393                switch (base) {
    394394                case 2:
    395395                        /* Binary formating is not standard, but usefull */
     
    455455        /* Print prefix */
    456456        if (flags & __PRINTF_FLAG_PREFIX) {
    457                 switch(base) {
     457                switch (base) {
    458458                case 2:
    459459                        /* Binary formating is not standard, but usefull */
     
    570570 *
    571571 *  - P, p Print value of a pointer. Void * value is expected and it is
    572  *         printed in hexadecimal notation with prefix (as with \%#X / \%#x
    573  *         for 32-bit or \%#X / \%#x for 64-bit long pointers).
     572 *         printed in hexadecimal notation with prefix (as with
     573 *         \%#0.8X / \%#0.8x for 32-bit or \%#0.16lX / \%#0.16lx for 64-bit
     574 *         long pointers).
    574575 *
    575576 *  - b Print value as unsigned binary number. Prefix is not printed by
     
    784785                        case 'p':
    785786                                flags |= __PRINTF_FLAG_PREFIX;
     787                                flags |= __PRINTF_FLAG_ZEROPADDED;
    786788                                base = 16;
    787789                                qualifier = PrintfQualifierPointer;
     
    846848                        case PrintfQualifierPointer:
    847849                                size = sizeof(void *);
    848                                 number = (uint64_t) (unsigned long) va_arg(ap, void *);
     850                                precision = size << 1;
     851                                number = (uint64_t) (uintptr_t) va_arg(ap, void *);
    849852                                break;
    850853                        default:
Note: See TracChangeset for help on using the changeset viewer.