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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ieee80211/src/ieee80211_impl.c

    r3061bc1 ra35b458  
    119119{
    120120        fibril_mutex_lock(&ieee80211_dev->scan_mutex);
    121        
     121
    122122        if (ieee80211_get_auth_phase(ieee80211_dev) ==
    123123            IEEE80211_AUTH_DISCONNECTED) {
    124124                fibril_mutex_lock(&ieee80211_dev->ap_list.results_mutex);
    125                
     125
    126126                /* Remove old entries we don't receive beacons from. */
    127127                ieee80211_scan_result_list_t *result_list =
    128128                    &ieee80211_dev->ap_list;
    129                
     129
    130130                list_foreach_safe(result_list->list, cur_link, next_link) {
    131131                        ieee80211_scan_result_link_t *cur_result =
    132132                            list_get_instance(cur_link,
    133133                            ieee80211_scan_result_link_t, link);
    134                        
     134
    135135                        if ((time(NULL) - cur_result->last_beacon) >
    136136                            MAX_KEEP_SCAN_SPAN_SEC)
     
    138138                                    cur_result);
    139139                }
    140                
     140
    141141                fibril_mutex_unlock(&ieee80211_dev->ap_list.results_mutex);
    142                
     142
    143143                uint16_t orig_freq = ieee80211_dev->current_freq;
    144                
     144
    145145                for (uint16_t freq = IEEE80211_FIRST_FREQ;
    146146                    freq <= IEEE80211_MAX_FREQ; freq += IEEE80211_CHANNEL_GAP) {
    147147                        if (ieee80211_pending_connect_request(ieee80211_dev))
    148148                                break;
    149                        
     149
    150150                        ieee80211_dev->ops->set_freq(ieee80211_dev, freq);
    151151                        ieee80211_probe_request(ieee80211_dev, NULL);
    152                        
     152
    153153                        /* Wait for probe responses. */
    154154                        async_usleep(SCAN_CHANNEL_WAIT_USEC);
    155155                }
    156                
     156
    157157                ieee80211_dev->ops->set_freq(ieee80211_dev, orig_freq);
    158158        }
    159        
     159
    160160        fibril_mutex_unlock(&ieee80211_dev->scan_mutex);
    161        
     161
    162162        return EOK;
    163163}
     
    183183        if ((!key) || (!data))
    184184                return EINVAL;
    185        
     185
    186186        if (!hash)
    187187                return ENOMEM;
    188        
     188
    189189        size_t iters = ((output_size * 8) + 159) / 160;
    190        
     190
    191191        const char *a = "Pairwise key expansion";
    192192        uint8_t result[HASH_SHA1 * iters];
    193193        uint8_t temp[HASH_SHA1];
    194        
     194
    195195        size_t data_size = PRF_CRYPT_DATA_LENGTH + str_size(a) + 2;
    196196        uint8_t work_arr[data_size];
    197197        memset(work_arr, 0, data_size);
    198        
     198
    199199        memcpy(work_arr, a, str_size(a));
    200200        memcpy(work_arr + str_size(a) + 1, data, PRF_CRYPT_DATA_LENGTH);
    201        
     201
    202202        for (uint8_t i = 0; i < iters; i++) {
    203203                memcpy(work_arr + data_size - 1, &i, 1);
     
    206206                memcpy(result + i*HASH_SHA1, temp, HASH_SHA1);
    207207        }
    208        
     208
    209209        memcpy(hash, result, output_size);
    210        
     210
    211211        return EOK;
    212212}
     
    223223        if ((!kek) || (!data))
    224224                return EINVAL;
    225        
     225
    226226        if (!output)
    227227                return ENOMEM;
    228        
     228
    229229        uint32_t n = data_size / 8 - 1;
    230230        uint8_t work_data[n * 8];
     
    233233        uint8_t *work_block;
    234234        uint8_t a[8];
    235        
     235
    236236        memcpy(a, data, 8);
    237        
     237
    238238        uint64_t mask = 0xff;
    239239        uint8_t shift, shb;
    240        
     240
    241241        memcpy(work_data, data + 8, n * 8);
    242242        for (int j = 5; j >= 0; j--) {
     
    247247                                a[k] ^= shb;
    248248                        }
    249                        
     249
    250250                        work_block = work_data + (i - 1) * 8;
    251251                        memcpy(work_input, a, 8);
     
    256256                }
    257257        }
    258        
     258
    259259        size_t it;
    260260        for (it = 0; it < 8; it++) {
     
    262262                        break;
    263263        }
    264        
     264
    265265        if (it == 8) {
    266266                memcpy(output, work_data, n * 8);
    267267                return EOK;
    268268        }
    269        
     269
    270270        return EINVAL;
    271271}
     
    290290        if ((!key) || (!buffer))
    291291                return EINVAL;
    292        
     292
    293293        if (!mic)
    294294                return ENOMEM;
    295        
     295
    296296        uint32_t l = uint32le_from_seq(key);
    297297        uint32_t r = uint32le_from_seq(key + 4);
    298        
     298
    299299        ieee80211_data_header_t *data_header =
    300300            (ieee80211_data_header_t *) buffer;
    301        
     301
    302302        uint8_t *data = buffer + sizeof(ieee80211_data_header_t) +
    303303            IEEE80211_TKIP_HEADER_LENGTH;
    304304        size_t data_size = size - sizeof(ieee80211_data_header_t) -
    305305            IEEE80211_TKIP_HEADER_LENGTH;
    306        
     306
    307307        /* Process header. */
    308308        uint8_t *src_addr =
     
    312312            ieee80211_is_tods_frame(data_header->frame_ctrl) ?
    313313            data_header->address3 : data_header->address1;
    314        
     314
    315315        ieee80211_michael_mic_block(&l, &r, uint32le_from_seq(dest_addr));
    316316        ieee80211_michael_mic_block(&l, &r,
     
    319319        ieee80211_michael_mic_block(&l, &r, uint32le_from_seq(src_addr + 2));
    320320        ieee80211_michael_mic_block(&l, &r, 0);
    321        
     321
    322322        /* Process data. */
    323323        size_t blocks = data_size / 4;
    324324        size_t pad = data_size % 4;
    325        
     325
    326326        for (size_t k = 0; k < blocks; k++) {
    327327                ieee80211_michael_mic_block(&l, &r,
    328328                    uint32le_from_seq(&data[k * 4]));
    329329        }
    330        
     330
    331331        /* Add padding. */
    332332        uint32_t value = 0x5a;
     
    335335                value |= data[blocks * 4 + (i - 1)];
    336336        }
    337        
     337
    338338        ieee80211_michael_mic_block(&l, &r, value);
    339339        ieee80211_michael_mic_block(&l, &r, 0);
    340        
     340
    341341        l = host2uint32_t_le(l);
    342342        r = host2uint32_t_le(r);
    343        
     343
    344344        memcpy(mic, &l, 4);
    345345        memcpy(mic + 4, &r, 4);
    346        
     346
    347347        return EOK;
    348348}
     
    376376        if (!sequence)
    377377                return ENOMEM;
    378        
     378
    379379        for (size_t i = 0; i < length; i++)
    380380                sequence[i] = (uint8_t) rand();
    381        
     381
    382382        return EOK;
    383383}
     
    387387        if ((!seq1) || (!seq2))
    388388                return NULL;
    389        
     389
    390390        for (size_t i = 0; i < size; i++) {
    391391                if (seq1[i] < seq2[i])
     
    394394                        return seq2;
    395395        }
    396        
     396
    397397        return seq1;
    398398}
     
    403403        if (min == seq1)
    404404                return seq2;
    405        
     405
    406406        return seq1;
    407407}
Note: See TracChangeset for help on using the changeset viewer.