Skip to content

Commit a1cb121

Browse files
committed
nvstore: astyle update
1 parent 35d03a6 commit a1cb121

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

features/nvstore/TESTS/nvstore/functionality/main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static void thread_test_check_key(uint16_t key)
359359

360360
if (key == thr_test_data->last_key) {
361361
if ((thr_test_data->sizes[key][thr_test_data->last_ind] == actual_len_bytes) &&
362-
(!memcmp(thr_test_data->buffs[key][thr_test_data->last_ind], get_buff, actual_len_bytes))) {
362+
(!memcmp(thr_test_data->buffs[key][thr_test_data->last_ind], get_buff, actual_len_bytes))) {
363363
return;
364364
}
365365
}
@@ -428,7 +428,7 @@ static void nvstore_multi_thread_test()
428428
}
429429

430430
for (i = 0; i < num_threads; i++) {
431-
threads[i] = new rtos::Thread((osPriority_t)((int)osPriorityBelowNormal-num_threads+i), thr_test_stack_size);
431+
threads[i] = new rtos::Thread((osPriority_t)((int)osPriorityBelowNormal - num_threads + i), thr_test_stack_size);
432432
threads[i]->start(callback(thread_test_worker));
433433
}
434434

@@ -529,7 +529,8 @@ static void nvstore_race_test()
529529

530530

531531

532-
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
532+
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason)
533+
{
533534
greentea_case_failure_abort_handler(source, reason);
534535
return STATUS_CONTINUE;
535536
}

features/nvstore/source/nvstore.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ static const uint16_t master_record_key = 0xFFE;
3939
static const uint16_t no_key = 0xFFF;
4040
static const uint16_t last_reserved_key = master_record_key;
4141

42-
typedef struct
43-
{
42+
typedef struct {
4443
uint16_t key_and_flags;
4544
uint16_t size;
4645
uint32_t crc;
@@ -79,10 +78,12 @@ static const uint8_t blank_flash_val = 0xFF;
7978
#endif
8079

8180
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{NVSTORE_AREA_1_ADDRESS, NVSTORE_AREA_1_SIZE},
82-
{NVSTORE_AREA_2_ADDRESS, NVSTORE_AREA_2_SIZE}};
81+
{NVSTORE_AREA_2_ADDRESS, NVSTORE_AREA_2_SIZE}
82+
};
8383
#else
8484
NVStore::nvstore_area_data_t NVStore::initial_area_params[] = {{0, 0},
85-
{0, 0}};
85+
{0, 0}
86+
};
8687
#endif
8788

8889
typedef enum {
@@ -121,18 +122,18 @@ static uint32_t crc32(uint32_t init_crc, uint32_t data_size, uint8_t *data_buf)
121122

122123
crc = init_crc;
123124
for (i = 0; i < data_size; i++) {
124-
crc = crc ^ (uint32_t) (data_buf[i]);
125+
crc = crc ^ (uint32_t)(data_buf[i]);
125126
for (j = 0; j < 8; j++) {
126-
mask = -(crc & 1);
127-
crc = (crc >> 1) ^ (0xEDB88320 & mask);
127+
mask = -(crc & 1);
128+
crc = (crc >> 1) ^ (0xEDB88320 & mask);
128129
}
129130
}
130131
return crc;
131132
}
132133

133134
NVStore::NVStore() : _init_done(0), _init_attempts(0), _active_area(0), _max_keys(NVSTORE_MAX_KEYS),
134-
_active_area_version(0), _free_space_offset(0), _size(0), _mutex(0), _offset_by_key(0), _flash(0),
135-
_min_prog_size(0), _page_buf(0)
135+
_active_area_version(0), _free_space_offset(0), _size(0), _mutex(0), _offset_by_key(0), _flash(0),
136+
_min_prog_size(0), _page_buf(0)
136137
{
137138
}
138139

@@ -261,7 +262,7 @@ void NVStore::calc_validate_area_params()
261262
_flash_area_params[area].size = 0;
262263
int i;
263264
for (i = num_sectors - 1; i >= 0; i--) {
264-
sector_size = sector_map[i+1] - sector_map[i];
265+
sector_size = sector_map[i + 1] - sector_map[i];
265266
_flash_area_params[area].size += sector_size;
266267
if (_flash_area_params[area].size >= min_area_size) {
267268
_flash_area_params[area].address = sector_map[i];
@@ -524,7 +525,7 @@ int NVStore::garbage_collection(uint16_t key, uint16_t flags, uint16_t buf_size,
524525
return ret;
525526
}
526527
_offset_by_key[key] = new_area_offset | (1 - _active_area) << offs_by_key_area_bit_pos |
527-
(((flags & set_once_flag) != 0) << offs_by_key_set_once_bit_pos);
528+
(((flags & set_once_flag) != 0) << offs_by_key_set_once_bit_pos);
528529
new_area_offset = next_offset;
529530
}
530531

features/nvstore/source/nvstore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class NVStore : private mbed::NonCopyable<NVStore> {
6161
*
6262
* @returns Singleton instance reference.
6363
*/
64-
static NVStore& get_instance()
64+
static NVStore &get_instance()
6565
{
6666
// Use this implementation of singleton (Meyer's) rather than the one that allocates
6767
// the instance on the heap because it ensures destruction at program end (preventing warnings

0 commit comments

Comments
 (0)