mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 05:13:33 +08:00
parameters: simplify import mark_unsaved and don't fail bson decode unnecessarily
This commit is contained in:
@@ -529,11 +529,8 @@ do_load(const char *param_file_name)
|
||||
static int
|
||||
do_import(const char *param_file_name)
|
||||
{
|
||||
bool mark_saved = false;
|
||||
|
||||
if (param_file_name == nullptr) {
|
||||
param_file_name = param_get_default_file();
|
||||
mark_saved = true; // if imported from default storage, mark as saved
|
||||
}
|
||||
|
||||
int fd = -1;
|
||||
@@ -549,7 +546,7 @@ do_import(const char *param_file_name)
|
||||
PX4_INFO("importing from '%s'", param_file_name);
|
||||
}
|
||||
|
||||
int result = param_import(fd, mark_saved);
|
||||
int result = param_import(fd);
|
||||
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
|
||||
@@ -96,7 +96,7 @@ encode(bson_encoder_t encoder)
|
||||
}
|
||||
|
||||
static int
|
||||
decode_callback(bson_decoder_t decoder, void *priv, bson_node_t node)
|
||||
decode_callback(bson_decoder_t decoder, bson_node_t node)
|
||||
{
|
||||
unsigned len;
|
||||
|
||||
@@ -287,7 +287,7 @@ test_bson(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* now test-decode it */
|
||||
if (bson_decoder_init_buf(&decoder, buf, len, decode_callback, nullptr)) {
|
||||
if (bson_decoder_init_buf(&decoder, buf, len, decode_callback)) {
|
||||
PX4_ERR("FAIL: bson_decoder_init_buf");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ bool ParameterTest::exportImportAll()
|
||||
return false;
|
||||
}
|
||||
|
||||
result = param_import(fd, false);
|
||||
result = param_import(fd);
|
||||
close(fd);
|
||||
|
||||
if (result < 0) {
|
||||
|
||||
Reference in New Issue
Block a user