Changeset a35b458 in mainline for boot/generic/src


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

Location:
boot/generic/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • boot/generic/src/balloc.c

    r3061bc1 ra35b458  
    4949        if (alignment == 0)
    5050                return NULL;
    51        
     51
    5252        /* Enforce minimal alignment. */
    5353        alignment = ALIGN_UP(alignment, 4);
    54        
     54
    5555        uintptr_t addr = phys_base + ALIGN_UP(ballocs->size, alignment);
    56        
     56
    5757        if (ALIGN_UP(ballocs->size, alignment) + size >= max_size)
    5858                return NULL;
    59        
     59
    6060        ballocs->size = ALIGN_UP(ballocs->size, alignment) + size;
    61        
     61
    6262        return (void *) addr;
    6363}
  • boot/generic/src/inflate.c

    r3061bc1 ra35b458  
    103103        size_t destlen;   /**< Output buffer size */
    104104        size_t destcnt;   /**< Position in the output buffer */
    105        
     105
    106106        uint8_t *src;     /**< Input buffer */
    107107        size_t srclen;    /**< Input buffer size */
    108108        size_t srccnt;    /**< Position in the input buffer */
    109        
     109
    110110        uint16_t bitbuf;  /**< Bit buffer */
    111111        size_t bitlen;    /**< Number of bits in the bit buffer */
    112        
     112
    113113        bool overrun;     /**< Overrun condition */
    114114} inflate_state_t;
     
    240240        /* Bit accumulator for at least 20 bits */
    241241        uint32_t val = state->bitbuf;
    242        
     242
    243243        while (state->bitlen < cnt) {
    244244                if (state->srccnt == state->srclen) {
     
    246246                        return 0;
    247247                }
    248                
     248
    249249                /* Load 8 more bits */
    250250                val |= ((uint32_t) state->src[state->srccnt]) << state->bitlen;
     
    252252                state->bitlen += 8;
    253253        }
    254        
     254
    255255        /* Update bits in the buffer */
    256256        state->bitbuf = (uint16_t) (val >> cnt);
    257257        state->bitlen -= cnt;
    258        
     258
    259259        return ((uint16_t) (val & ((1 << cnt) - 1)));
    260260}
     
    275275        state->bitbuf = 0;
    276276        state->bitlen = 0;
    277        
     277
    278278        if (state->srccnt + 4 > state->srclen)
    279279                return ELIMIT;
    280        
     280
    281281        uint16_t len =
    282282            state->src[state->srccnt] | (state->src[state->srccnt + 1] << 8);
    283283        uint16_t len_compl =
    284284            state->src[state->srccnt + 2] | (state->src[state->srccnt + 3] << 8);
    285        
     285
    286286        /* Check block length and its complement */
    287287        if (((int16_t) len) != ~((int16_t) len_compl))
    288288                return EINVAL;
    289        
     289
    290290        state->srccnt += 4;
    291        
     291
    292292        /* Check input buffer size */
    293293        if (state->srccnt + len > state->srclen)
    294294                return ELIMIT;
    295        
     295
    296296        /* Check output buffer size */
    297297        if (state->destcnt + len > state->destlen)
    298298                return ENOMEM;
    299        
     299
    300300        /* Copy data */
    301301        memcpy(state->dest + state->destcnt, state->src + state->srccnt, len);
    302302        state->srccnt += len;
    303303        state->destcnt += len;
    304        
     304
    305305        return EOK;
    306306}
     
    323323        size_t index = 0;  /* Index of the first code of the given length
    324324                              in the symbol table */
    325        
     325
    326326        size_t len;  /* Current number of bits in the code */
    327327        for (len = 1; len <= MAX_HUFFMAN_BIT; len++) {
     
    329329                code |= get_bits(state, 1);
    330330                CHECK_OVERRUN(*state);
    331                
     331
    332332                uint16_t count = huffman->count[len];
    333333                if (code < first + count) {
     
    336336                        return EOK;
    337337                }
    338                
     338
    339339                /* Update for next length */
    340340                index += count;
     
    343343                code <<= 1;
    344344        }
    345        
     345
    346346        return EINVAL;
    347347}
     
    364364        for (len = 0; len <= MAX_HUFFMAN_BIT; len++)
    365365                huffman->count[len] = 0;
    366        
     366
    367367        /* We assume that the lengths are within bounds */
    368368        size_t symbol;
    369369        for (symbol = 0; symbol < n; symbol++)
    370370                huffman->count[length[symbol]]++;
    371        
     371
    372372        if (huffman->count[0] == n) {
    373373                /* The code is complete, but decoding will fail */
    374374                return 0;
    375375        }
    376        
     376
    377377        /* Check for an over-subscribed or incomplete set of lengths */
    378378        int16_t left = 1;
     
    385385                }
    386386        }
    387        
     387
    388388        /* Generate offsets into symbol table */
    389389        uint16_t offs[MAX_HUFFMAN_BIT + 1];
    390        
     390
    391391        offs[1] = 0;
    392392        for (len = 1; len < MAX_HUFFMAN_BIT; len++)
    393393                offs[len + 1] = offs[len] + huffman->count[len];
    394        
     394
    395395        for (symbol = 0; symbol < n; symbol++) {
    396396                if (length[symbol] != 0) {
     
    399399                }
    400400        }
    401        
     401
    402402        return left;
    403403}
     
    422422{
    423423        uint16_t symbol;
    424        
     424
    425425        do {
    426426                int err = huffman_decode(state, len_code, &symbol);
     
    429429                        return err;
    430430                }
    431                
     431
    432432                if (symbol < 256) {
    433433                        /* Write out literal */
    434434                        if (state->destcnt == state->destlen)
    435435                                return ENOMEM;
    436                        
     436
    437437                        state->dest[state->destcnt] = (uint8_t) symbol;
    438438                        state->destcnt++;
     
    442442                        if (symbol >= 29)
    443443                                return EINVAL;
    444                        
     444
    445445                        size_t len = lens[symbol] + get_bits(state, lens_ext[symbol]);
    446446                        CHECK_OVERRUN(*state);
    447                        
     447
    448448                        /* Get distance */
    449449                        err = huffman_decode(state, dist_code, &symbol);
    450450                        if (err != EOK)
    451451                                return err;
    452                        
     452
    453453                        size_t dist = dists[symbol] + get_bits(state, dists_ext[symbol]);
    454454                        if (dist > state->destcnt)
    455455                                return ENOENT;
    456                        
     456
    457457                        if (state->destcnt + len > state->destlen)
    458458                                return ENOMEM;
    459                        
     459
    460460                        while (len > 0) {
    461461                                /* Copy len bytes from distance bytes back */
     
    467467                }
    468468        } while (symbol != 256);
    469        
     469
    470470        return EOK;
    471471}
     
    510510        huffman_t dyn_len_code;
    511511        huffman_t dyn_dist_code;
    512        
     512
    513513        dyn_len_code.count = dyn_len_count;
    514514        dyn_len_code.symbol = dyn_len_symbol;
    515        
     515
    516516        dyn_dist_code.count = dyn_dist_count;
    517517        dyn_dist_code.symbol = dyn_dist_symbol;
    518        
     518
    519519        /* Get number of bits in each table */
    520520        uint16_t nlen = get_bits(state, 5) + 257;
    521521        CHECK_OVERRUN(*state);
    522        
     522
    523523        uint16_t ndist = get_bits(state, 5) + 1;
    524524        CHECK_OVERRUN(*state);
    525        
     525
    526526        uint16_t ncode = get_bits(state, 4) + 4;
    527527        CHECK_OVERRUN(*state);
    528        
     528
    529529        if ((nlen > MAX_LITLEN) || (ndist > MAX_DIST)
    530530            || (ncode > MAX_ORDER))
    531531                return EINVAL;
    532        
     532
    533533        /* Read code length code lengths */
    534534        uint16_t index;
     
    537537                CHECK_OVERRUN(*state);
    538538        }
    539        
     539
    540540        /* Set missing lengths to zero */
    541541        for (index = ncode; index < MAX_ORDER; index++)
    542542                length[order[index]] = 0;
    543        
     543
    544544        /* Build Huffman code */
    545545        int16_t rc = huffman_construct(&dyn_len_code, length, MAX_ORDER);
    546546        if (rc != 0)
    547547                return EINVAL;
    548        
     548
    549549        /* Read length/literal and distance code length tables */
    550550        index = 0;
     
    554554                if (err != EOK)
    555555                        return EOK;
    556                
     556
    557557                if (symbol < 16) {
    558558                        length[index] = symbol;
     
    560560                } else {
    561561                        uint16_t len = 0;
    562                        
     562
    563563                        if (symbol == 16) {
    564564                                if (index == 0)
    565565                                        return EINVAL;
    566                                
     566
    567567                                len = length[index - 1];
    568568                                symbol = get_bits(state, 2) + 3;
     
    575575                                CHECK_OVERRUN(*state);
    576576                        }
    577                        
     577
    578578                        if (index + symbol > nlen + ndist)
    579579                                return EINVAL;
    580                        
     580
    581581                        while (symbol > 0) {
    582582                                length[index] = len;
     
    586586                }
    587587        }
    588        
     588
    589589        /* Check for end-of-block code */
    590590        if (length[256] == 0)
    591591                return EINVAL;
    592        
     592
    593593        /* Build Huffman tables for literal/length codes */
    594594        rc = huffman_construct(&dyn_len_code, length, nlen);
    595595        if ((rc < 0) || ((rc > 0) && (dyn_len_code.count[0] + 1 != nlen)))
    596596                return EINVAL;
    597        
     597
    598598        /* Build Huffman tables for distance codes */
    599599        rc = huffman_construct(&dyn_dist_code, length + nlen, ndist);
    600600        if ((rc < 0) || ((rc > 0) && (dyn_dist_code.count[0] + 1 != ndist)))
    601601                return EINVAL;
    602        
     602
    603603        return inflate_codes(state, &dyn_len_code, &dyn_dist_code);
    604604}
     
    622622        /* Initialize the state */
    623623        inflate_state_t state;
    624        
     624
    625625        state.dest = (uint8_t *) dest;
    626626        state.destlen = destlen;
    627627        state.destcnt = 0;
    628        
     628
    629629        state.src = (uint8_t *) src;
    630630        state.srclen = srclen;
    631631        state.srccnt = 0;
    632        
     632
    633633        state.bitbuf = 0;
    634634        state.bitlen = 0;
    635        
     635
    636636        state.overrun = false;
    637        
     637
    638638        uint16_t last;
    639639        int ret = 0;
    640        
     640
    641641        do {
    642642                /* Last block is indicated by a non-zero bit */
    643643                last = get_bits(&state, 1);
    644644                CHECK_OVERRUN(state);
    645                
     645
    646646                /* Block type */
    647647                uint16_t type = get_bits(&state, 2);
    648648                CHECK_OVERRUN(state);
    649                
     649
    650650                switch (type) {
    651651                case 0:
     
    662662                }
    663663        } while ((!last) && (ret == 0));
    664        
     664
    665665        return ret;
    666666}
  • boot/generic/src/memstr.c

    r3061bc1 ra35b458  
    4646        uint8_t *dp = (uint8_t *) dst;
    4747        const uint8_t *sp = (uint8_t *) src;
    48        
     48
    4949        while (cnt-- != 0)
    5050                *dp++ = *sp++;
    51        
     51
    5252        return dst;
    5353}
     
    6767{
    6868        uint8_t *dp = (uint8_t *) dst;
    69        
     69
    7070        while (cnt-- != 0)
    7171                *dp++ = val;
    72        
     72
    7373        return dst;
    7474}
     
    9191        if (src == dst)
    9292                return dst;
    93        
     93
    9494        /* Non-overlapping? */
    9595        if ((dst >= src + cnt) || (src >= dst + cnt))
    9696                return memcpy(dst, src, cnt);
    97        
     97
    9898        uint8_t *dp;
    9999        const uint8_t *sp;
    100        
     100
    101101        /* Which direction? */
    102102        if (src > dst) {
     
    104104                dp = dst;
    105105                sp = src;
    106                
     106
    107107                while (cnt-- != 0)
    108108                        *dp++ = *sp++;
     
    111111                dp = dst + (cnt - 1);
    112112                sp = src + (cnt - 1);
    113                
     113
    114114                while (cnt-- != 0)
    115115                        *dp-- = *sp--;
    116116        }
    117        
     117
    118118        return dst;
    119119}
  • boot/generic/src/printf.c

    r3061bc1 ra35b458  
    3737        int ret;
    3838        va_list args;
    39        
     39
    4040        va_start(args, fmt);
    41        
     41
    4242        ret = vprintf(fmt, args);
    43        
     43
    4444        va_end(args);
    45        
     45
    4646        return ret;
    4747}
  • boot/generic/src/printf_core.c

    r3061bc1 ra35b458  
    138138        if (str == NULL)
    139139                return printf_putnchars(nullstr, str_size(nullstr), ps);
    140        
     140
    141141        return ps->str_write((void *) str, str_size(str), ps->data);
    142142}
     
    154154        if (!ascii_check(ch))
    155155                return ps->str_write((void *) &invalch, 1, ps->data);
    156        
     156
    157157        return ps->str_write(&ch, 1, ps->data);
    158158}
     
    180180                }
    181181        }
    182        
     182
    183183        if (printf_putchar(ch, ps) > 0)
    184184                counter++;
    185        
     185
    186186        while (--width > 0) {
    187187                /*
     
    192192                        counter++;
    193193        }
    194        
     194
    195195        return (int) (counter);
    196196}
     
    210210        if (str == NULL)
    211211                return printf_putstr(nullstr, ps);
    212        
     212
    213213        /* Print leading spaces. */
    214214        size_t strw = str_length(str);
    215215        if ((precision == 0) || (precision > strw))
    216216                precision = strw;
    217        
     217
    218218        /* Left padding */
    219219        size_t counter = 0;
     
    225225                }
    226226        }
    227        
     227
    228228        /* Part of @a str fitting into the alloted space. */
    229229        int retval;
     
    231231        if ((retval = printf_putnchars(str, size, ps)) < 0)
    232232                return -counter;
    233        
     233
    234234        counter += retval;
    235        
     235
    236236        /* Right padding */
    237237        while (width-- > 0) {
     
    264264        else
    265265                digits = digits_small;
    266        
     266
    267267        char data[PRINT_NUMBER_BUFFER_SIZE];
    268268        char *ptr = &data[PRINT_NUMBER_BUFFER_SIZE - 1];
    269        
     269
    270270        /* Size of number with all prefixes and signs */
    271271        int size = 0;
    272        
     272
    273273        /* Put zero at end of string */
    274274        *ptr-- = 0;
    275        
     275
    276276        if (num == 0) {
    277277                *ptr-- = '0';
     
    283283                } while (num /= base);
    284284        }
    285        
     285
    286286        /* Size of plain number */
    287287        int number_size = size;
    288        
     288
    289289        /*
    290290         * Collect the sum of all prefixes/signs/etc. to calculate padding and
     
    305305                }
    306306        }
    307        
     307
    308308        char sgn = 0;
    309309        if (flags & __PRINTF_FLAG_SIGNED) {
     
    319319                }
    320320        }
    321        
     321
    322322        if (flags & __PRINTF_FLAG_LEFTALIGNED)
    323323                flags &= ~__PRINTF_FLAG_ZEROPADDED;
    324        
     324
    325325        /*
    326326         * If the number is left-aligned or precision is specified then
     
    331331                        precision = width - size + number_size;
    332332        }
    333        
     333
    334334        /* Print leading spaces */
    335335        if (number_size > precision) {
     
    337337                precision = number_size;
    338338        }
    339        
     339
    340340        width -= precision + size - number_size;
    341341        size_t counter = 0;
    342        
     342
    343343        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
    344344                while (width-- > 0) {
     
    347347                }
    348348        }
    349        
     349
    350350        /* Print sign */
    351351        if (sgn) {
     
    353353                        counter++;
    354354        }
    355        
     355
    356356        /* Print prefix */
    357357        if (flags & __PRINTF_FLAG_PREFIX) {
     
    386386                }
    387387        }
    388        
     388
    389389        /* Print leading zeroes */
    390390        precision -= number_size;
     
    393393                        counter++;
    394394        }
    395        
     395
    396396        /* Print the number itself */
    397397        int retval;
    398398        if ((retval = printf_putstr(++ptr, ps)) > 0)
    399399                counter += retval;
    400        
     400
    401401        /* Print trailing spaces */
    402        
     402
    403403        while (width-- > 0) {
    404404                if (printf_putchar(' ', ps) == 1)
    405405                        counter++;
    406406        }
    407        
     407
    408408        return ((int) counter);
    409409}
     
    497497        size_t nxt = 0;  /* Index of the next character from fmt */
    498498        size_t j = 0;    /* Index to the first not printed nonformating character */
    499        
     499
    500500        size_t counter = 0;   /* Number of characters printed */
    501501        int retval;           /* Return values from nested functions */
    502        
     502
    503503        while (true) {
    504504                i = nxt;
    505505                wchar_t uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
    506                
     506
    507507                if (uc == 0)
    508508                        break;
    509                
     509
    510510                /* Control character */
    511511                if (uc == '%') {
     
    519519                                counter += retval;
    520520                        }
    521                        
     521
    522522                        j = i;
    523                        
     523
    524524                        /* Parse modifiers */
    525525                        uint32_t flags = 0;
    526526                        bool end = false;
    527                        
     527
    528528                        do {
    529529                                i = nxt;
     
    549549                                };
    550550                        } while (!end);
    551                        
     551
    552552                        /* Width & '*' operator */
    553553                        int width = 0;
     
    556556                                        width *= 10;
    557557                                        width += uc - '0';
    558                                        
     558
    559559                                        i = nxt;
    560560                                        uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
     
    575575                                }
    576576                        }
    577                        
     577
    578578                        /* Precision and '*' operator */
    579579                        int precision = 0;
     
    585585                                                precision *= 10;
    586586                                                precision += uc - '0';
    587                                                
     587
    588588                                                i = nxt;
    589589                                                uc = str_decode(fmt, &nxt, STR_NO_LIMIT);
     
    604604                                }
    605605                        }
    606                        
     606
    607607                        qualifier_t qualifier;
    608                        
     608
    609609                        switch (uc) {
    610610                        case 't':
     
    653653                                qualifier = PrintfQualifierInt;
    654654                        }
    655                        
     655
    656656                        unsigned int base = 10;
    657                        
     657
    658658                        switch (uc) {
    659659                        /*
     
    662662                        case 's':
    663663                                retval = print_str(va_arg(ap, char *), width, precision, flags, ps);
    664                                
     664
    665665                                if (retval < 0) {
    666666                                        counter = -counter;
    667667                                        goto out;
    668668                                }
    669                                
     669
    670670                                counter += retval;
    671671                                j = nxt;
     
    673673                        case 'c':
    674674                                retval = print_char(va_arg(ap, unsigned int), width, flags, ps);
    675                                
     675
    676676                                if (retval < 0) {
    677677                                        counter = -counter;
    678678                                        goto out;
    679679                                };
    680                                
     680
    681681                                counter += retval;
    682682                                j = nxt;
    683683                                goto next_char;
    684                        
     684
    685685                        /*
    686686                         * Integer values
     
    714714                                base = 16;
    715715                                break;
    716                        
     716
    717717                        /* Percentile itself */
    718718                        case '%':
    719719                                j = i;
    720720                                goto next_char;
    721                        
     721
    722722                        /*
    723723                         * Bad formatting.
     
    730730                                goto next_char;
    731731                        }
    732                        
     732
    733733                        /* Print integers */
    734734                        size_t size;
    735735                        uint64_t number;
    736                        
     736
    737737                        switch (qualifier) {
    738738                        case PrintfQualifierByte:
     
    774774                                goto out;
    775775                        }
    776                        
     776
    777777                        if ((retval = print_number(number, width, precision,
    778778                            base, flags, ps)) < 0) {
     
    780780                                goto out;
    781781                        }
    782                        
     782
    783783                        counter += retval;
    784784                        j = nxt;
     
    787787                ;
    788788        }
    789        
     789
    790790        if (i > j) {
    791791                if ((retval = printf_putnchars(&fmt[j], i - j, ps)) < 0) {
     
    796796                counter += retval;
    797797        }
    798        
     798
    799799out:
    800800        return ((int) counter);
  • boot/generic/src/str.c

    r3061bc1 ra35b458  
    141141        if (*offset + 1 > size)
    142142                return 0;
    143        
     143
    144144        /* First byte read from string */
    145145        uint8_t b0 = (uint8_t) str[(*offset)++];
    146        
     146
    147147        /* Determine code length */
    148        
     148
    149149        unsigned int b0_bits;  /* Data bits in first byte */
    150150        unsigned int cbytes;   /* Number of continuation bytes */
    151        
     151
    152152        if ((b0 & 0x80) == 0) {
    153153                /* 0xxxxxxx (Plain ASCII) */
     
    170170                return U_SPECIAL;
    171171        }
    172        
     172
    173173        if (*offset + cbytes > size)
    174174                return U_SPECIAL;
    175        
     175
    176176        wchar_t ch = b0 & LO_MASK_8(b0_bits);
    177        
     177
    178178        /* Decode continuation bytes */
    179179        while (cbytes > 0) {
    180180                uint8_t b = (uint8_t) str[(*offset)++];
    181                
     181
    182182                /* Must be 10xxxxxx */
    183183                if ((b & 0xc0) != 0x80)
    184184                        return U_SPECIAL;
    185                
     185
    186186                /* Shift data bits to ch */
    187187                ch = (ch << CONT_BITS) | (wchar_t) (b & LO_MASK_8(CONT_BITS));
    188188                cbytes--;
    189189        }
    190        
     190
    191191        return ch;
    192192}
     
    211211        if (*offset >= size)
    212212                return EOVERFLOW;
    213        
     213
    214214        if (!chr_check(ch))
    215215                return EINVAL;
    216        
     216
    217217        /* Unsigned version of ch (bit operations should only be done
    218218           on unsigned types). */
    219219        uint32_t cc = (uint32_t) ch;
    220        
     220
    221221        /* Determine how many continuation bytes are needed */
    222        
     222
    223223        unsigned int b0_bits;  /* Data bits in first byte */
    224224        unsigned int cbytes;   /* Number of continuation bytes */
    225        
     225
    226226        if ((cc & ~LO_MASK_32(7)) == 0) {
    227227                b0_bits = 7;
     
    240240                return EINVAL;
    241241        }
    242        
     242
    243243        /* Check for available space in buffer */
    244244        if (*offset + cbytes >= size)
    245245                return EOVERFLOW;
    246        
     246
    247247        /* Encode continuation bytes */
    248248        unsigned int i;
     
    251251                cc = cc >> CONT_BITS;
    252252        }
    253        
     253
    254254        /* Encode first byte */
    255255        str[*offset] = (cc & LO_MASK_32(b0_bits)) | HI_MASK_8(8 - b0_bits - 1);
    256        
     256
    257257        /* Advance offset */
    258258        *offset += cbytes + 1;
    259        
     259
    260260        return EOK;
    261261}
     
    274274{
    275275        size_t size = 0;
    276        
     276
    277277        while (*str++ != 0)
    278278                size++;
    279        
     279
    280280        return size;
    281281}
     
    298298        size_t len = 0;
    299299        size_t offset = 0;
    300        
     300
    301301        while (len < max_len) {
    302302                if (str_decode(str, &offset, STR_NO_LIMIT) == 0)
    303303                        break;
    304                
     304
    305305                len++;
    306306        }
    307        
     307
    308308        return offset;
    309309}
     
    320320        size_t len = 0;
    321321        size_t offset = 0;
    322        
     322
    323323        while (str_decode(str, &offset, STR_NO_LIMIT) != 0)
    324324                len++;
    325        
     325
    326326        return len;
    327327}
     
    336336        if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 127))
    337337                return true;
    338        
     338
    339339        return false;
    340340}
     
    349349        if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 1114111))
    350350                return true;
    351        
     351
    352352        return false;
    353353}
     
    375375        wchar_t c1 = 0;
    376376        wchar_t c2 = 0;
    377        
     377
    378378        size_t off1 = 0;
    379379        size_t off2 = 0;
    380        
     380
    381381        while (true) {
    382382                c1 = str_decode(s1, &off1, STR_NO_LIMIT);
    383383                c2 = str_decode(s2, &off2, STR_NO_LIMIT);
    384                
     384
    385385                if (c1 < c2)
    386386                        return -1;
    387                
     387
    388388                if (c1 > c2)
    389389                        return 1;
    390                
     390
    391391                if ((c1 == 0) || (c2 == 0))
    392392                        break;
    393393        }
    394        
     394
    395395        return 0;
    396396}
     
    412412        size_t src_off = 0;
    413413        size_t dest_off = 0;
    414        
     414
    415415        wchar_t ch;
    416416        while ((ch = str_decode(src, &src_off, STR_NO_LIMIT)) != 0) {
     
    418418                        break;
    419419        }
    420        
     420
    421421        dest[dest_off] = '\0';
    422422}
  • boot/generic/src/vprintf.c

    r3061bc1 ra35b458  
    4040        size_t offset = 0;
    4141        size_t chars = 0;
    42        
     42
    4343        while (offset < size) {
    4444                putchar(str_decode(str, &offset, size));
    4545                chars++;
    4646        }
    47        
     47
    4848        return chars;
    4949}
     
    5454        size_t chars = 0;
    5555        wchar_t uc;
    56        
     56
    5757        while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
    5858                putchar(uc);
    5959                chars++;
    6060        }
    61        
     61
    6262        return chars;
    6363}
     
    6969                NULL
    7070        };
    71        
     71
    7272        int ret = printf_core(fmt, &ps, ap);
    73        
     73
    7474        return ret;
    7575}
Note: See TracChangeset for help on using the changeset viewer.