Merge branch 'bugfix/gcc8_compile_errors' into 'master'

Fix GCC 8 compile errors

See merge request idf/esp-idf!2466
This commit is contained in:
Anton Maklakov
2018-07-02 17:43:02 +08:00
6 changed files with 19 additions and 16 deletions

View File

@@ -134,7 +134,7 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat
fl_ota_data_erase = true; fl_ota_data_erase = true;
} }
// partition->label is not null-terminated string. // partition->label is not null-terminated string.
strncpy(label, (char *)&partition->label, sizeof(partition->label)); strncpy(label, (char *)&partition->label, sizeof(label) - 1);
if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) { if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) {
err = esp_rom_spiflash_erase_area(partition->pos.offset, partition->pos.size); err = esp_rom_spiflash_erase_area(partition->pos.offset, partition->pos.size);
if (err != ESP_OK) { if (err != ESP_OK) {

View File

@@ -77,7 +77,7 @@ void esp_ipc_init()
{ {
s_ipc_mutex = xSemaphoreCreateMutex(); s_ipc_mutex = xSemaphoreCreateMutex();
s_ipc_ack = xSemaphoreCreateBinary(); s_ipc_ack = xSemaphoreCreateBinary();
char task_name[8]; char task_name[15];
for (int i = 0; i < portNUM_PROCESSORS; ++i) { for (int i = 0; i < portNUM_PROCESSORS; ++i) {
sprintf(task_name,"ipc%d",i); sprintf(task_name,"ipc%d",i);
s_ipc_sem[i] = xSemaphoreCreateBinary(); s_ipc_sem[i] = xSemaphoreCreateBinary();

View File

@@ -5975,7 +5975,7 @@ FRESULT f_fdisk (
BYTE s_hd, e_hd, *p, *buf = (BYTE*)work; BYTE s_hd, e_hd, *p, *buf = (BYTE*)work;
DSTATUS stat; DSTATUS stat;
DWORD sz_disk, sz_part, s_part; DWORD sz_disk, sz_part, s_part;
DWORD cluster_size = CLUSTER_SIZE; DWORD cluster_size = CLUSTER_SIZE;
FRESULT res; FRESULT res;
@@ -5991,14 +5991,17 @@ FRESULT f_fdisk (
if (!buf) return FR_NOT_ENOUGH_CORE; if (!buf) return FR_NOT_ENOUGH_CORE;
/* Determine the CHS without any consideration of the drive geometry */ /* Determine the CHS without any consideration of the drive geometry */
for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2) ; for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2)
{
;
}
if (n == 256) n--; if (n == 256) n--;
if (sz_disk < SUPPORTED_FLASH_SIZE) { if (sz_disk < SUPPORTED_FLASH_SIZE) {
cluster_size = 1; cluster_size = 1;
n = sz_disk; n = sz_disk;
} }
e_hd = n - 1; e_hd = n - 1;
sz_cyl = cluster_size * n; sz_cyl = cluster_size * n;
tot_cyl = sz_disk / sz_cyl; tot_cyl = sz_disk / sz_cyl;
/* Create partition table */ /* Create partition table */
@@ -6011,7 +6014,7 @@ FRESULT f_fdisk (
sz_part = (DWORD)sz_cyl * p_cyl; sz_part = (DWORD)sz_cyl * p_cyl;
if (i == 0) { /* Exclude first track of cylinder 0 */ if (i == 0) { /* Exclude first track of cylinder 0 */
s_hd = 1; s_hd = 1;
s_part += cluster_size; sz_part -= cluster_size; s_part += cluster_size; sz_part -= cluster_size;
} else { } else {
s_hd = 0; s_hd = 0;
} }

View File

@@ -402,7 +402,7 @@ struct _reent
char *_asctime_buf; char *_asctime_buf;
/* signal info */ /* signal info */
void (**(_sig_func))(int); void (**_sig_func)(int);
# ifndef _REENT_GLOBAL_ATEXIT # ifndef _REENT_GLOBAL_ATEXIT
/* atexit stuff */ /* atexit stuff */

View File

@@ -176,7 +176,7 @@ static esp_err_t load_partitions()
} }
// it->label may not be zero-terminated // it->label may not be zero-terminated
strncpy(item->info.label, (const char*) it->label, sizeof(it->label)); strncpy(item->info.label, (const char*) it->label, sizeof(item->info.label) - 1);
item->info.label[sizeof(it->label)] = 0; item->info.label[sizeof(it->label)] = 0;
// add it to the list // add it to the list
if (last == NULL) { if (last == NULL) {

View File

@@ -407,7 +407,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2; ret = -2;
goto _out; goto _out;
} }
os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN); os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1);
sm->blob[0].len = g_wpa_client_cert_len; sm->blob[0].len = g_wpa_client_cert_len;
sm->blob[0].data = g_wpa_client_cert; sm->blob[0].data = g_wpa_client_cert;
} }
@@ -418,7 +418,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2; ret = -2;
goto _out; goto _out;
} }
os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN); os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1);
sm->blob[1].len = g_wpa_private_key_len; sm->blob[1].len = g_wpa_private_key_len;
sm->blob[1].data = g_wpa_private_key; sm->blob[1].data = g_wpa_private_key;
} }
@@ -429,7 +429,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
ret = -2; ret = -2;
goto _out; goto _out;
} }
os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN); os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1);
sm->blob[2].len = g_wpa_ca_cert_len; sm->blob[2].len = g_wpa_ca_cert_len;
sm->blob[2].data = g_wpa_ca_cert; sm->blob[2].data = g_wpa_ca_cert;
} }