Cleanup: compiler warnings with clang

Includes use of memcpy to avoid warnings about deprecated members.
This commit is contained in:
Brecht Van Lommel
2021-12-18 05:46:41 +01:00
parent 3471b0016c
commit 4c3f57ffa7
4 changed files with 13 additions and 11 deletions

View File

@@ -917,7 +917,7 @@ static void curve_to_mesh_eval_ensure(Object &object)
* will have no modifiers. */
Object bevel_object = {{nullptr}};
if (curve.bevobj != nullptr) {
bevel_object = *curve.bevobj;
memcpy(&bevel_object, curve.bevobj, sizeof(bevel_object));
BLI_listbase_clear(&bevel_object.modifiers);
BKE_object_runtime_reset(&bevel_object);
curve.bevobj = &bevel_object;
@@ -926,7 +926,7 @@ static void curve_to_mesh_eval_ensure(Object &object)
/* Same thing for taper. */
Object taper_object = {{nullptr}};
if (curve.taperobj != nullptr) {
taper_object = *curve.taperobj;
memcpy(&taper_object, curve.taperobj, sizeof(taper_object));
BLI_listbase_clear(&taper_object.modifiers);
BKE_object_runtime_reset(&taper_object);
curve.taperobj = &taper_object;
@@ -1065,7 +1065,8 @@ static Mesh *mesh_new_from_mesh_object_with_layers(Depsgraph *depsgraph,
return nullptr;
}
Object object_for_eval = *object;
Object object_for_eval;
memcpy(&object_for_eval, object, sizeof(object_for_eval));
if (object_for_eval.runtime.data_orig != nullptr) {
object_for_eval.data = object_for_eval.runtime.data_orig;
}
@@ -1440,7 +1441,8 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src,
/* mesh_src might depend on mesh_dst, so we need to do everything with a local copy */
/* TODO(Sybren): the above claim came from 2.7x derived-mesh code (DM_to_mesh);
* check whether it is still true with Mesh */
Mesh tmp = *mesh_dst;
Mesh tmp;
memcpy(&tmp, mesh_dst, sizeof(tmp));
int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly;
bool did_shapekeys = false;
eCDAllocType alloctype = CD_DUPLICATE;

View File

@@ -934,10 +934,10 @@ static bool has_external_files(Main *bmain, struct ReportList *reports)
BKE_reportf(
callback_info.reports,
RPT_ERROR,
"Unable to copy bundle due to %ld external dependencies; more details on the console",
callback_info.external_files.size());
printf("Unable to copy bundle due to %ld external dependencies:\n",
callback_info.external_files.size());
"Unable to copy bundle due to %zu external dependencies; more details on the console",
(size_t)callback_info.external_files.size());
printf("Unable to copy bundle due to %zu external dependencies:\n",
(size_t)callback_info.external_files.size());
for (const std::string &path : callback_info.external_files) {
printf(" \"%s\"\n", path.c_str());
}

View File

@@ -231,7 +231,7 @@ class Shader : public SocketDeclaration {
bNodeSocket &build(bNodeTree &ntree, bNode &node) const override;
bool matches(const bNodeSocket &socket) const override;
bool can_connect(const bNodeSocket &socket) const;
bool can_connect(const bNodeSocket &socket) const override;
};
class ShaderBuilder : public SocketDeclarationBuilder<Shader> {

View File

@@ -979,8 +979,8 @@ static void do_mesh_separation(GeometrySet &geometry_set,
/* Needed in all cases. */
Vector<int> selected_poly_indices;
Vector<int> new_loop_starts;
int num_selected_polys;
int num_selected_loops;
int num_selected_polys = 0;
int num_selected_loops = 0;
const Mesh &mesh_in = *in_component.get_for_read();
Mesh *mesh_out;