Using C-types only in capi function definitions.

This commit is contained in:
Patrick Shriwise 2019-07-18 12:29:30 -05:00
parent 54df651888
commit 520b07a131
2 changed files with 4 additions and 4 deletions

View file

@ -1085,14 +1085,14 @@ openmc_cell_get_temperature(int32_t index, const int32_t* instance, double* T)
//! Get the name of a cell
extern "C" int
openmc_cell_get_name(int32_t index, char*& name) {
openmc_cell_get_name(int32_t index, char** name) {
if (index < 0 || index >= model::cells.size()) {
strcpy(openmc_err_msg, "Index in cells array is out of bounds.");
return OPENMC_E_OUT_OF_BOUNDS;
}
auto name_str = model::cells[index]->name_;
strcpy(name, name_str.c_str());
strcpy(*name, name_str.c_str());
return 0;
}

View file

@ -1382,14 +1382,14 @@ openmc_material_set_id(int32_t index, int32_t id)
}
extern "C" int
openmc_material_get_name(int32_t index, char*& name) {
openmc_material_get_name(int32_t index, char** name) {
if (index < 0 || index >= model::materials.size()) {
strcpy(openmc_err_msg, "Index in materials array is out of bounds.");
return OPENMC_E_OUT_OF_BOUNDS;
}
auto name_str = model::materials[index]->name();
strcpy(name, name_str.c_str());
strcpy(*name, name_str.c_str());
return 0;
}