Changeset 8565a42 in mainline for uspace/lib/c/generic/io/vsnprintf.c


Ignore:
Timestamp:
2018-03-02T20:34:50Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/vsnprintf.c

    r3061bc1 r8565a42  
    6565{
    6666        size_t left = data->size - data->len;
    67        
     67
    6868        if (left == 0)
    6969                return ((int) size);
    70        
     70
    7171        if (left == 1) {
    7272                /* We have only one free byte left in buffer
     
    7777                return ((int) size);
    7878        }
    79        
     79
    8080        if (left <= size) {
    8181                /* We do not have enough space for the whole string
     
    8484                 */
    8585                size_t index = 0;
    86                
     86
    8787                while (index < size) {
    8888                        wchar_t uc = str_decode(str, &index, size);
    89                        
     89
    9090                        if (chr_encode(uc, data->dst, &data->len, data->size - 1) != EOK)
    9191                                break;
    9292                }
    93                
     93
    9494                /* Put trailing zero at end, but not count it
    9595                 * into data->len so it could be rewritten next time
    9696                 */
    9797                data->dst[data->len] = 0;
    98                
     98
    9999                return ((int) size);
    100100        }
    101        
     101
    102102        /* Buffer is big enough to print the whole string */
    103103        memcpy((void *)(data->dst + data->len), (void *) str, size);
    104104        data->len += size;
    105        
     105
    106106        /* Put trailing zero at end, but not count it
    107107         * into data->len so it could be rewritten next time
    108108         */
    109109        data->dst[data->len] = 0;
    110        
     110
    111111        return ((int) size);
    112112}
     
    132132{
    133133        size_t index = 0;
    134        
     134
    135135        while (index < (size / sizeof(wchar_t))) {
    136136                size_t left = data->size - data->len;
    137                
     137
    138138                if (left == 0)
    139139                        return ((int) size);
    140                
     140
    141141                if (left == 1) {
    142142                        /* We have only one free byte left in buffer
     
    147147                        return ((int) size);
    148148                }
    149                
     149
    150150                if (chr_encode(str[index], data->dst, &data->len, data->size - 1) != EOK)
    151151                        break;
    152                
     152
    153153                index++;
    154154        }
    155        
     155
    156156        /* Put trailing zero at end, but not count it
    157157         * into data->len so it could be rewritten next time
    158158         */
    159159        data->dst[data->len] = 0;
    160        
     160
    161161        return ((int) size);
    162162}
     
    174174                &data
    175175        };
    176        
     176
    177177        /* Print 0 at end of string - fix the case that nothing will be printed */
    178178        if (size > 0)
    179179                str[0] = 0;
    180        
     180
    181181        /* vsnprintf_write ensures that str will be terminated by zero. */
    182182        return printf_core(fmt, &ps, ap);
Note: See TracChangeset for help on using the changeset viewer.