Page MenuHome

Fix C++ .stl importer unused function result warning
ClosedPublic

Authored by Iyad Ahmed (iyadahmed2001) on Jun 14 2022, 10:50 AM.

Details

Summary

Fix unused function result warnings on Linux for usages of fread in the C++ .stl importer

Diff Detail

Repository
rB Blender

Event Timeline

Sybren A. Stüvel (sybren) requested changes to this revision.Jun 14 2022, 10:56 AM
Sybren A. Stüvel (sybren) added inline comments.
source/blender/io/stl/importer/stl_import.cc
69

I don't quite understand this logic. If this fread fails, why is the file considered to be ASCII?

source/blender/io/stl/importer/stl_import_binary_reader.cc
37

This should also print the actual error from the OS. Now there is no way for the reader of the message to understand what's wrong or how to fix it.
This can be done, for example, with perror()

This revision now requires changes to proceed.Jun 14 2022, 10:56 AM
source/blender/io/stl/importer/stl_import.cc
71

Could also output the error here if the fread fails

source/blender/io/stl/importer/stl_import.cc
71

That would be good, yes. And probably also abort the import, as I don't think such errors should go unnoticed.

Iyad Ahmed (iyadahmed2001) marked 4 inline comments as done.
Sybren A. Stüvel (sybren) requested changes to this revision.Jun 23 2022, 10:55 AM
Sybren A. Stüvel (sybren) added inline comments.
source/blender/io/stl/importer/stl_import.cc
60–65

The same question still applies: why is it okay to silently ignore the error in certain cases?

60–65

This can be refactored into a stl_import_report_error(file) function, so that the logic isn't duplicated below.

This revision now requires changes to proceed.Jun 23 2022, 10:55 AM

Ok will make these changes asap, just saw

Iyad Ahmed (iyadahmed2001) marked 2 inline comments as done.Jun 28 2022, 12:17 AM
This revision is now accepted and ready to land.Jun 30 2022, 10:13 AM