tools: overhaul csv handling for mfg_gen and nvs_partition_gen
This fixes the issue where multiline strings and strings with delimiters inside the nvs input csv file were incorrectly parsed, and adds back the ability to add comment lines anywhere in the CSV file. The issue stems from the move away from the python built in csv module to manual parsing, which was made after moving away from using the csv module to parse mfg data. This reverts back to using the csv module for parsing and writing csv data in both mfg_gen and nvs_partition_gen, fixes the original issue in mfg_gen and improves code quality which makes the code more readable and maintainable. Closes https://github.com/espressif/esp-idf/issues/7175
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include "nvs_encrypted_partition.hpp"
|
||||
@@ -105,7 +97,7 @@ esp_err_t NVSEncryptedPartition::write(size_t addr, const void* src, size_t size
|
||||
data_unit,
|
||||
buf + offset,
|
||||
buf + offset) != 0) {
|
||||
delete buf;
|
||||
delete [] buf;
|
||||
return ESP_ERR_NVS_XTS_ENCR_FAILED;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +105,7 @@ esp_err_t NVSEncryptedPartition::write(size_t addr, const void* src, size_t size
|
||||
// write data
|
||||
esp_err_t result = esp_partition_write(mESPPartition, addr, buf, size);
|
||||
|
||||
delete buf;
|
||||
delete [] buf;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user