parameters: simplify import mark_unsaved and don't fail bson decode unnecessarily

This commit is contained in:
Daniel Agar
2021-12-24 14:32:40 -05:00
parent d1cd4904dc
commit 3f3836afa8
8 changed files with 43 additions and 95 deletions
+1 -4
View File
@@ -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);
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -561,7 +561,7 @@ bool ParameterTest::exportImportAll()
return false;
}
result = param_import(fd, false);
result = param_import(fd);
close(fd);
if (result < 0) {