diff --git a/include/ccaosdb.h b/include/ccaosdb.h index 63a768a48f2987e9fbaed1041e9d6bca2ca78cb8..b41e8322036c5c07592426ccd958e1eed48ba042 100644 --- a/include/ccaosdb.h +++ b/include/ccaosdb.h @@ -279,11 +279,13 @@ int caosdb_connection_connection_create_transaction(caosdb_connection_connection int caosdb_transaction_delete_transaction(caosdb_transaction_transaction *transaction); int caosdb_transaction_transaction_retrieve_by_id(caosdb_transaction_transaction *transaction, const char *id); -int caosdb_transaction_transaction_retrieve_and_download_file_by_id(caosdb_transaction_transaction *transaction, - const char *id, - const char *path); -int caosdb_transaction_transaction_retrieve_by_ids(caosdb_transaction_transaction *transaction, - const char *ids[], int length); +int caosdb_transaction_transaction_retrieve_and_download_file_by_id( + caosdb_transaction_transaction *transaction, + const char *id, + const char *path); +int caosdb_transaction_transaction_retrieve_by_ids( + caosdb_transaction_transaction *transaction, + const char *ids[], int length); int caosdb_transaction_transaction_query(caosdb_transaction_transaction *transaction, const char *query); int caosdb_transaction_transaction_execute(caosdb_transaction_transaction *transaction); diff --git a/src/ccaosdb.cpp b/src/ccaosdb.cpp index 38a08db24de93422299d9bb750ab52e2e014b310..d5165c98e64b7084a395a710a5bd1b98019f9edb 100644 --- a/src/ccaosdb.cpp +++ b/src/ccaosdb.cpp @@ -75,7 +75,7 @@ extern "C" { GENERIC_ERROR, \ int caosdb_entity_entity_get_##element(caosdb_entity_entity *entity, char **out), { \ auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); \ - char *tmp = (char *)malloc(sizeof(char) * wrapped_entity->GetFunction.length() + 1); \ + auto *tmp = (char *)malloc(sizeof(char) * wrapped_entity->GetFunction.length() + 1); \ strcpy(tmp, wrapped_entity->GetFunction.c_str()); \ delete[] * out; \ *out = tmp; \ @@ -101,7 +101,7 @@ extern "C" { GENERIC_ERROR, \ int caosdb_entity_property_get_##element(caosdb_entity_property *property, char **out), { \ auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); \ - char *tmp = (char *)malloc(sizeof(char) * wrapped_property->GetFunction.length() + 1); \ + auto *tmp = (char *)malloc(sizeof(char) * wrapped_property->GetFunction.length() + 1); \ strcpy(tmp, wrapped_property->GetFunction.c_str()); \ delete[] * out; \ *out = tmp; \ @@ -128,7 +128,7 @@ extern "C" { GENERIC_ERROR, \ int caosdb_entity_parent_get_##element(caosdb_entity_parent *parent, char **out), { \ auto *wrapped_parent = WRAPPED_PARENT_CAST(parent); \ - char *tmp = (char *)malloc(sizeof(char) * wrapped_parent->GetFunction.length() + 1); \ + auto *tmp = (char *)malloc(sizeof(char) * wrapped_parent->GetFunction.length() + 1); \ strcpy(tmp, wrapped_parent->GetFunction.c_str()); \ delete[] * out; \ *out = tmp; \ @@ -338,12 +338,12 @@ ERROR_RETURN_CODE( out->patch = (int)version_info->GetPatch(); // copy pre_release, needs local variable because out->pre_release is const - char *pre_release = (char *)malloc(sizeof(char) * (version_info->GetPreRelease().length() + 1)); + auto *pre_release = (char *)malloc(sizeof(char) * (version_info->GetPreRelease().length() + 1)); strcpy(pre_release, version_info->GetPreRelease().c_str()); out->pre_release = pre_release; // copy build, needs local variable because out->build is const - char *build = (char *)malloc(sizeof(char) * (version_info->GetBuild().length() + 1)); + auto *build = (char *)malloc(sizeof(char) * (version_info->GetBuild().length() + 1)); strcpy(build, version_info->GetBuild().c_str()); out->build = build; @@ -588,7 +588,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, int caosdb_entity_entity_get_role(caosdb_entity_entity *entity, char **out), { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); std::string role_str = ENUM_NAME_FROM_VALUE(wrapped_entity->GetRole(), Role); - char *tmp = (char *)malloc(sizeof(char) * role_str.length() + 1); + auto *tmp = (char *)malloc(sizeof(char) * role_str.length() + 1); strcpy(tmp, role_str.c_str()); delete[] * out; *out = tmp; @@ -600,7 +600,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); auto path = wrapped_entity->GetLocalPath().string(); - char *tmp = (char *)malloc(sizeof(char) * path.length() + 1); + auto *tmp = (char *)(malloc(sizeof(char) * path.length() + 1)); strcpy(tmp, path.c_str()); delete[] * out; *out = tmp; @@ -951,7 +951,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); auto value_list = wrapped_property->GetValue().AsList(); - char *tmp = + auto *tmp = (char *)malloc(sizeof(char) * value_list[index].AsString().length() + 1); strcpy(tmp, value_list[index].AsString().c_str()); delete[] * out; @@ -984,7 +984,7 @@ ERROR_RETURN_CODE( GENERIC_ERROR, int caosdb_entity_message_get_description(caosdb_entity_message *message, char **out), { auto *wrapped_message = static_cast<caosdb::entity::Message *>(message->wrapped_message); - char *tmp = (char *)malloc(sizeof(char) * wrapped_message->GetDescription().length() + 1); + auto *tmp = (char *)malloc(sizeof(char) * wrapped_message->GetDescription().length() + 1); strcpy(tmp, wrapped_message->GetDescription().c_str()); delete[] * out; *out = tmp; diff --git a/test/test_ccaosdb.cpp b/test/test_ccaosdb.cpp index 92429b55637ddbc3553f46927319974ba9684627..c497b47d8b973199a07828a61dd6af57b0f84664 100644 --- a/test/test_ccaosdb.cpp +++ b/test/test_ccaosdb.cpp @@ -465,7 +465,7 @@ TEST_F(test_ccaosdb, test_remove_property) { } TEST_F(test_ccaosdb, test_insert_update_delete) { - // Only test adding to a transaction, excution and results are + // Only test adding to a transaction. Excution and results are // tested in integration tests. caosdb_connection_connection connection; caosdb_connection_connection_manager_get_default_connection(&connection);